cocoa_common: make fullscreen menubar/dock hiding conditional

cocoa_common was hiding the dock and menubar unconditionally when
going fullscreen. This means they were hidden even if they weren't on
the screen mplayer2 was going fullscreen on, resulting in poor user
experience.

Change the fullscreen function in the cocoa backend to check that
mplayer2 is on the same screen as the menubar/dock before hiding them.
This commit is contained in:
Stefano Pigozzi 2012-06-24 23:03:56 +02:00 committed by wm4
parent f5b8b6ac12
commit 09c5324314
1 changed files with 9 additions and 1 deletions

View File

@ -189,6 +189,13 @@ void vo_cocoa_uninit(struct vo *vo)
s = nil;
}
static int current_screen_has_dock_or_menubar(void)
{
NSRect f = s->screen_frame;
NSRect vf = [s->screen_handle visibleFrame];
return f.size.height > vf.size.height || f.size.width > vf.size.width;
}
void update_screen_info(void)
{
s->screen_array = [NSScreen screens];
@ -510,7 +517,8 @@ void create_menu()
{
if (!vo_fs) {
update_screen_info();
[NSApp setPresentationOptions:NSApplicationPresentationHideDock|NSApplicationPresentationHideMenuBar];
if (current_screen_has_dock_or_menubar())
[NSApp setPresentationOptions:NSApplicationPresentationHideDock|NSApplicationPresentationHideMenuBar];
s->windowed_frame = [self frame];
[self setHasShadow:NO];
[self setStyleMask:s->fullscreen_mask];