[vlc-commits] macosx: correctly hide the fspanel if app resigns active state ( close #12277)
Felix Paul Kühne
git at videolan.org
Wed Oct 1 13:53:02 CEST 2014
vlc/vlc-2.2 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Oct 1 13:50:25 2014 +0200| [37a84eb2190fb5df56095ce400ab46dbae2b93b6] | committer: 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)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=37a84eb2190fb5df56095ce400ab46dbae2b93b6
---
modules/gui/macosx/fspanel.h | 1 -
modules/gui/macosx/fspanel.m | 26 ++++++++++++++------------
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/modules/gui/macosx/fspanel.h b/modules/gui/macosx/fspanel.h
index 636432c..614dfff 100644
--- a/modules/gui/macosx/fspanel.h
+++ b/modules/gui/macosx/fspanel.h
@@ -45,7 +45,6 @@
styleMask: (NSUInteger)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag;
-- (void)awakeFromNib;
- (BOOL)canBecomeKeyWindow;
- (void)dealloc;
diff --git a/modules/gui/macosx/fspanel.m b/modules/gui/macosx/fspanel.m
index fad739c..41ab7a9 100644
--- a/modules/gui/macosx/fspanel.m
+++ b/modules/gui/macosx/fspanel.m
@@ -48,6 +48,10 @@
defer:(BOOL)flag
{
id win = [super initWithContentRect:contentRect styleMask:NSTexturedBackgroundWindowMask backing:bufferingType defer:flag];
+
+ if (!win)
+ return win;
+
self.contentView = [[VLCFSPanelView alloc] initWithFrame:contentRect];
[win setOpaque:NO];
[win setHasShadow: NO];
@@ -61,11 +65,7 @@
hideAgainTimer = fadeTimer = nil;
[self setFrameAutosaveName:@"fspanel"];
[self setNonActive:nil];
- return win;
-}
-- (void)awakeFromNib
-{
[self setContentView:[[VLCFSPanelView alloc] initWithFrame: [self frame]]];
BOOL isInside = (NSPointInRect([NSEvent mouseLocation],[self frame]));
[[self contentView] addTrackingRect:[[self contentView] bounds] owner:self userData:nil assumeInside:isInside];
@@ -79,18 +79,20 @@
/* get a notification if VLC isn't the active app anymore */
[[NSNotificationCenter defaultCenter]
- addObserver: self
- selector: @selector(setNonActive:)
- name: NSApplicationDidResignActiveNotification
- object: NSApp];
+ addObserver: self
+ selector: @selector(setNonActive:)
+ name: NSApplicationDidResignActiveNotification
+ object: NSApp];
/* Get a notification if VLC is the active app again.
Needed as becomeKeyWindow does not get called when window is activated by clicking */
[[NSNotificationCenter defaultCenter]
- addObserver: self
- selector: @selector(setActive:)
- name: NSApplicationDidBecomeActiveNotification
- object: NSApp];
+ addObserver: self
+ selector: @selector(setActive:)
+ name: NSApplicationDidBecomeActiveNotification
+ object: NSApp];
+
+ return win;
}
/* make sure that we don't become key, since we can't handle hotkeys */
More information about the vlc-commits
mailing list