Commit 37a84eb2 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: correctly hide the fspanel if app resigns active state (close #12277)

awakeFromNib is no longer called on fspanel (as there is no nib anymore), so don't rely on it

(cherry picked from commit 51d5f1efb0e77d254d3754c6cf5f6a9856365c52)
parent 54b6ab86
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
styleMask: (NSUInteger)aStyle styleMask: (NSUInteger)aStyle
backing: (NSBackingStoreType)bufferingType backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag; defer: (BOOL)flag;
- (void)awakeFromNib;
- (BOOL)canBecomeKeyWindow; - (BOOL)canBecomeKeyWindow;
- (void)dealloc; - (void)dealloc;
......
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
defer:(BOOL)flag defer:(BOOL)flag
{ {
id win = [super initWithContentRect:contentRect styleMask:NSTexturedBackgroundWindowMask backing:bufferingType defer:flag]; id win = [super initWithContentRect:contentRect styleMask:NSTexturedBackgroundWindowMask backing:bufferingType defer:flag];
if (!win)
return win;
self.contentView = [[VLCFSPanelView alloc] initWithFrame:contentRect]; self.contentView = [[VLCFSPanelView alloc] initWithFrame:contentRect];
[win setOpaque:NO]; [win setOpaque:NO];
[win setHasShadow: NO]; [win setHasShadow: NO];
...@@ -61,11 +65,7 @@ ...@@ -61,11 +65,7 @@
hideAgainTimer = fadeTimer = nil; hideAgainTimer = fadeTimer = nil;
[self setFrameAutosaveName:@"fspanel"]; [self setFrameAutosaveName:@"fspanel"];
[self setNonActive:nil]; [self setNonActive:nil];
return win;
}
- (void)awakeFromNib
{
[self setContentView:[[VLCFSPanelView alloc] initWithFrame: [self frame]]]; [self setContentView:[[VLCFSPanelView alloc] initWithFrame: [self frame]]];
BOOL isInside = (NSPointInRect([NSEvent mouseLocation],[self frame])); BOOL isInside = (NSPointInRect([NSEvent mouseLocation],[self frame]));
[[self contentView] addTrackingRect:[[self contentView] bounds] owner:self userData:nil assumeInside:isInside]; [[self contentView] addTrackingRect:[[self contentView] bounds] owner:self userData:nil assumeInside:isInside];
...@@ -79,18 +79,20 @@ ...@@ -79,18 +79,20 @@
/* get a notification if VLC isn't the active app anymore */ /* get a notification if VLC isn't the active app anymore */
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
addObserver: self addObserver: self
selector: @selector(setNonActive:) selector: @selector(setNonActive:)
name: NSApplicationDidResignActiveNotification name: NSApplicationDidResignActiveNotification
object: NSApp]; object: NSApp];
/* Get a notification if VLC is the active app again. /* Get a notification if VLC is the active app again.
Needed as becomeKeyWindow does not get called when window is activated by clicking */ Needed as becomeKeyWindow does not get called when window is activated by clicking */
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
addObserver: self addObserver: self
selector: @selector(setActive:) selector: @selector(setActive:)
name: NSApplicationDidBecomeActiveNotification name: NSApplicationDidBecomeActiveNotification
object: NSApp]; object: NSApp];
return win;
} }
/* make sure that we don't become key, since we can't handle hotkeys */ /* make sure that we don't become key, since we can't handle hotkeys */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment