From 9dda04b93dfe657465cbdd3e36e9b3d2c9e16f02 Mon Sep 17 00:00:00 2001 From: David Fuhrmann Date: Sat, 9 Nov 2013 17:26:46 +0100 Subject: [PATCH] macosx: fix float-on-top-behaviour if setting is changed while in fullscreen --- modules/gui/macosx/VLCVoutWindowController.m | 17 +++++++++-------- modules/gui/macosx/Windows.m | 14 +++++++++++--- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m index 55c177e55b..67daa6a46e 100644 --- a/modules/gui/macosx/VLCVoutWindowController.m +++ b/modules/gui/macosx/VLCVoutWindowController.m @@ -276,10 +276,18 @@ - (void)setWindowLevel:(NSInteger)i_level forWindow:(vout_window_t *)p_wnd { + VLCVideoWindowCommon *o_window = [o_vout_dict objectForKey:[NSValue valueWithPointer:p_wnd]]; + if (!o_window) { + msg_Err(VLCIntf, "Cannot set level for nonexisting window"); + return; + } + // only set level for helper windows to normal if no status vout window exist anymore if(i_level == NSStatusWindowLevel) { i_statusLevelWindowCounter++; - [self updateWindowLevelForHelperWindows:i_level]; + // window level need to stay on normal in fullscreen mode + if (![o_window fullscreen]) + [self updateWindowLevelForHelperWindows:i_level]; } else { if (i_statusLevelWindowCounter > 0) i_statusLevelWindowCounter--; @@ -289,16 +297,9 @@ } } - VLCVideoWindowCommon *o_window = [o_vout_dict objectForKey:[NSValue valueWithPointer:p_wnd]]; - if (!o_window) { - msg_Err(VLCIntf, "Cannot set size for nonexisting window"); - return; - } - [o_window setWindowLevel:i_level]; } - - (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd { intf_thread_t *p_intf = VLCIntf; diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m index a9fa222f7a..f71799e757 100644 --- a/modules/gui/macosx/Windows.m +++ b/modules/gui/macosx/Windows.m @@ -465,8 +465,14 @@ if (var_InheritBool(VLCIntf, "video-wallpaper") || [self level] < NSNormalWindowLevel) return; - [self setLevel: i_state]; - + if (!b_fullscreen) + [self setLevel: i_state]; + else { + // only save it for restore + // TODO this does not handle the case when level is + // changed in the middle of a fullscreen animation + i_originalLevel = i_state; + } } - (NSRect)getWindowRectForProposedVideoViewSize:(NSSize)size @@ -628,6 +634,7 @@ [[VLCMainWindow sharedInstance] recreateHideMouseTimer]; i_originalLevel = [self level]; + // b_fullscreen must not be true yet [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel]; [self setLevel:NSNormalWindowLevel]; @@ -764,10 +771,10 @@ /* Make sure we don't see the window flashes in float-on-top mode */ i_originalLevel = [self level]; + // b_fullscreen must not be true yet [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel]; [self setLevel:NSNormalWindowLevel]; - /* Only create the o_fullscreen_window if we are not in the middle of the zooming animation */ if (!o_fullscreen_window) { /* We can't change the styleMask of an already created NSWindow, so we create another window, and do eye catching stuff */ @@ -1037,6 +1044,7 @@ [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: i_originalLevel]; [self setLevel:i_originalLevel]; + [self setAlphaValue: config_GetFloat(VLCIntf, "macosx-opaqueness")]; // if we quit fullscreen because there is no video anymore, make sure non-embedded window is not visible -- 2.39.2