1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-04 05:52:09 +00:00

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
This commit is contained in:
reimar 2009-09-02 14:02:15 +00:00
parent 001e4be0ba
commit 7a7c246709

View File

@ -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: