changeset 29588:17d7ae586d03

Reduce code duplication for half/normal/double video size handling.
author reimar
date Wed, 02 Sep 2009 14:02:15 +0000
parents b1f7d992a246
children 5ed139ad6dfd
files libvo/vo_quartz.c
diffstat 1 files changed, 19 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_quartz.c	Wed Sep 02 11:38:18 2009 +0000
+++ b/libvo/vo_quartz.c	Wed Sep 02 14:02:15 2009 +0000
@@ -348,19 +348,31 @@
     return result;
 }
 
+static void set_winSizeMult(float mult)
+{
+    int d_width, d_height;
+    aspect(&d_width, &d_height, A_NOZOOM);
+
+    if (vo_quartz_fs)
+    {
+        vo_fs = (!(vo_fs));
+        window_fullscreen();
+    }
+
+    winSizeMult = mult;
+    SizeWindow(theWindow, d_width * mult, d_height * mult, 1);
+    window_resized();
+}
+
 //default window event handler
 static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData)
 {
     OSStatus result = noErr;
-    uint32_t d_width;
-    uint32_t d_height;
     UInt32 class = GetEventClass(event);
     UInt32 kind = GetEventKind(event);
 
     result = CallNextEventHandler(nextHandler, event);
 
-    aspect(&d_width, &d_height, A_NOZOOM);
-
     if (class == kEventClassCommand)
     {
         HICommand theHICommand;
@@ -374,39 +386,15 @@
             break;
 
         case kHalfScreenCmd:
-            if (vo_quartz_fs)
-            {
-                vo_fs = (!(vo_fs));
-                window_fullscreen();
-            }
-
-            winSizeMult = 0.5;
-            SizeWindow(theWindow, d_width / 2, d_height / 2, 1);
-            window_resized();
+            set_winSizeMult(0.5);
             break;
 
         case kNormalScreenCmd:
-            if (vo_quartz_fs)
-            {
-                vo_fs = (!(vo_fs));
-                window_fullscreen();
-            }
-
-            winSizeMult = 1;
-            SizeWindow(theWindow, d_width, d_height, 1);
-            window_resized();
+            set_winSizeMult(1);
             break;
 
         case kDoubleScreenCmd:
-            if (vo_quartz_fs)
-            {
-                vo_fs = (!(vo_fs));
-                window_fullscreen();
-            }
-
-            winSizeMult = 2;
-            SizeWindow(theWindow, d_width * 2, d_height * 2, 1);
-            window_resized();
+            set_winSizeMult(2);
             break;
 
         case kFullScreenCmd: