summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-09-02 14:02:15 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-09-02 14:02:15 +0000
commit7a7c246709d5f3dd6fb89cf9a27af232c42dc755 (patch)
tree07e4ce8e55836673ea3c6abd25b363097efdc587 /libvo
parent001e4be0bafad31241e2e6415dcc0988938a1a34 (diff)
downloadmpv-7a7c246709d5f3dd6fb89cf9a27af232c42dc755.tar.bz2
mpv-7a7c246709d5f3dd6fb89cf9a27af232c42dc755.tar.xz
Reduce code duplication for half/normal/double video size handling.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29630 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_quartz.c50
1 files changed, 19 insertions, 31 deletions
diff --git a/libvo/vo_quartz.c b/libvo/vo_quartz.c
index 21a6d0865a..642e12b972 100644
--- a/libvo/vo_quartz.c
+++ b/libvo/vo_quartz.c
@@ -348,19 +348,31 @@ static OSStatus MouseEventHandler(EventHandlerCallRef nextHandler, EventRef even
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 @@ static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef eve
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: