[vlc-commits] macosx: fixed 'intf-show' and 'intf-toggle-fscontrol' hotkeys

Felix Paul Kühne git at videolan.org
Fri Jan 27 19:30:03 CET 2012


vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Jan 27 10:35:22 2012 +0100| [2f59334a27e85face0048d0147f7d18c61229e1b] | committer: Jean-Baptiste Kempf

macosx: fixed 'intf-show' and 'intf-toggle-fscontrol' hotkeys
(cherry picked from commit f78f3ae2873fefc52f67d84e7c1edb6c520c2271)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=2f59334a27e85face0048d0147f7d18c61229e1b
---

 modules/gui/macosx/intf.h |    1 +
 modules/gui/macosx/intf.m |   22 +++++++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h
index eeb3adc..e4be09f 100644
--- a/modules/gui/macosx/intf.h
+++ b/modules/gui/macosx/intf.h
@@ -189,6 +189,7 @@ struct intf_sys_t
 - (void)updateInfoandMetaPanel;
 - (void)updateMainMenu;
 - (void)updateMainWindow;
+- (void)showMainWindow;
 - (void)showFullscreenController;
 - (void)updateDelays;
 - (void)initStrings;
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index a793bf5..93bd22b 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -374,7 +374,16 @@ static int ShowController( vlc_object_t *p_this, const char *psz_variable,
     intf_thread_t * p_intf = VLCIntf;
     if( p_intf && p_intf->p_sys )
     {
-//        [[[VLCMain sharedInstance] fspanel] makeKeyAndOrderFront: nil];
+        playlist_t * p_playlist = pl_Get( p_intf );
+        BOOL b_fullscreen = var_GetBool( p_playlist, "fullscreen" );
+        if( strcmp(psz_variable, "intf-toggle-fscontrol") || b_fullscreen )
+        {
+            [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(showFullscreenController) withObject:nil waitUntilDone:NO];
+        }
+        else
+        {
+            [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(showMainWindow) withObject:nil waitUntilDone:NO];
+        }
     }
     return VLC_SUCCESS;
 }
@@ -570,7 +579,8 @@ static VLCMain *_o_sharedMainInstance = nil;
 
     var_AddCallback(p_playlist, "fullscreen", FullscreenChanged, self);
     var_AddCallback( p_intf->p_libvlc, "intf-toggle-fscontrol", ShowController, self);
-//    var_AddCallback(p_playlist, "item-change", PLItemChanged, self);
+    var_AddCallback( p_intf->p_libvlc, "intf-show", ShowController, self);
+    //    var_AddCallback(p_playlist, "item-change", PLItemChanged, self);
     var_AddCallback(p_playlist, "item-current", PLItemChanged, self);
     var_AddCallback(p_playlist, "activity", PLItemChanged, self);
     var_AddCallback(p_playlist, "leaf-to-parent", PlaylistUpdated, self);
@@ -728,6 +738,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     var_DelCallback(p_playlist, "mute", VolumeUpdated, self);
     var_DelCallback(p_playlist, "fullscreen", FullscreenChanged, self);
     var_DelCallback(p_intf->p_libvlc, "intf-toggle-fscontrol", ShowController, self);
+    var_DelCallback(p_intf->p_libvlc, "intf-show", ShowController, self);
 
     /* remove global observer watching for vout device changes correctly */
     [[NSNotificationCenter defaultCenter] removeObserver: self];
@@ -1398,9 +1409,14 @@ unsigned int CocoaKeyToVLC( unichar i_key )
     [o_mainwindow updateWindow];
 }
 
+- (void)showMainWindow
+{
+    [o_mainwindow performSelectorOnMainThread:@selector(makeKeyAndOrderFront:) withObject:nil waitUntilDone:NO];
+}
+
 - (void)showFullscreenController
 {
-    [o_mainwindow showFullscreenController];
+    [o_mainwindow performSelectorOnMainThread:@selector(showFullscreenController) withObject:nil waitUntilDone:NO];
 }
 
 - (void)updateDelays



More information about the vlc-commits mailing list