From 09c5324314d941355523dd5e78842495877d5696 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 24 Jun 2012 23:03:56 +0200 Subject: 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. --- libvo/cocoa_common.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'libvo') diff --git a/libvo/cocoa_common.m b/libvo/cocoa_common.m index d1e835105e..331072afcf 100644 --- a/libvo/cocoa_common.m +++ b/libvo/cocoa_common.m @@ -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]; -- cgit v1.2.3