[vlc-commits] macosx: fspanel: give up focus to the right fullscreen window

David Fuhrmann git at videolan.org
Sat Oct 20 15:33:39 CEST 2012


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sat Oct 20 11:46:25 2012 +0200| [87937a2d4a93c543d1f9a6012869278856e814d7] | committer: David Fuhrmann

macosx: fspanel: give up focus to the right fullscreen window

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=87937a2d4a93c543d1f9a6012869278856e814d7
---

 modules/gui/macosx/MainWindow.m |    2 +-
 modules/gui/macosx/Windows.m    |    2 +-
 modules/gui/macosx/fspanel.h    |    5 ++++-
 modules/gui/macosx/fspanel.m    |   18 +++++++++++-------
 4 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 976faa3..736f965 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -958,7 +958,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     // But this creates some problems when leaving fs over remote intfs, so activate app here.
     [NSApp activateIgnoringOtherApps:YES];
 
-    [o_fspanel setVoutWasUpdated: (int)[[self screen] displayID]];
+    [o_fspanel setVoutWasUpdated: self];
     [o_fspanel setActive: nil];
 }
 
diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index fd06467..e849c0e 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -656,7 +656,7 @@
     [o_fullscreen_window setAcceptsMouseMovedEvents: YES];
 
     /* tell the fspanel to move itself to front next time it's triggered */
-    [[[VLCMainWindow sharedInstance] fsPanel] setVoutWasUpdated: (int)[[o_fullscreen_window screen] displayID]];
+    [[[VLCMainWindow sharedInstance] fsPanel] setVoutWasUpdated: o_fullscreen_window];
     [[[VLCMainWindow sharedInstance] fsPanel] setActive: nil];
 
     if ([self isVisible])
diff --git a/modules/gui/macosx/fspanel.h b/modules/gui/macosx/fspanel.h
index 62c1bcc..d51198b 100644
--- a/modules/gui/macosx/fspanel.h
+++ b/modules/gui/macosx/fspanel.h
@@ -22,6 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+ at class VLCWindow;
 
 @interface VLCFSPanel : NSWindow
 {
@@ -36,6 +37,8 @@
     BOOL b_displayed;
     BOOL b_voutWasUpdated;
     int i_device;
+
+    VLCWindow *o_vout_window;
 }
 - (id)initWithContentRect: (NSRect)contentRect
                 styleMask: (NSUInteger)aStyle
@@ -70,7 +73,7 @@
 - (void)mouseDown: (NSEvent *)theEvent;
 - (void)mouseDragged: (NSEvent *)theEvent;
 
-- (void)setVoutWasUpdated: (int)i_screen;
+- (void)setVoutWasUpdated: (VLCWindow *)o_window;
 @end
 
 @interface VLCFSPanelView : NSView
diff --git a/modules/gui/macosx/fspanel.m b/modules/gui/macosx/fspanel.m
index 0572120..78c6c23 100644
--- a/modules/gui/macosx/fspanel.m
+++ b/modules/gui/macosx/fspanel.m
@@ -108,6 +108,10 @@
         [hideAgainTimer invalidate];
         [hideAgainTimer release];
     }
+
+    if (o_vout_window)
+        [o_vout_window release];
+
     [self setFadeTimer:nil];
     [super dealloc];
 }
@@ -236,12 +240,8 @@
 - (void)mouseExited:(NSEvent *)theEvent
 {
     /* give up our focus, so the vout may show us again without letting the user clicking it */
-    vout_thread_t *p_vout = getVout();
-    if (p_vout) {
-        if (var_GetBool(p_vout, "fullscreen"))
-            [[[[VLCMainWindow sharedInstance] videoView] window] makeKeyWindow];
-        vlc_object_release(p_vout);
-    }
+    if (o_vout_window && var_GetBool(pl_Get(VLCIntf), "fullscreen"))
+        [o_vout_window makeKeyWindow];
 }
 
 - (void)hideMouse
@@ -351,9 +351,13 @@
     [self setFrameOrigin:point];
 }
 
-- (void)setVoutWasUpdated: (int)i_newdevice;
+- (void)setVoutWasUpdated: (VLCWindow *)o_window
 {
     b_voutWasUpdated = YES;
+    if (o_vout_window)
+        [o_vout_window release];
+    o_vout_window = [o_window retain];
+    int i_newdevice = (int)[[o_vout_window screen] displayID];
     if(i_newdevice != i_device) {
         i_device = i_newdevice;
         [self center];



More information about the vlc-commits mailing list