[vlc-commits] macosx: Allow toggling of bookmark window

David Fuhrmann git at videolan.org
Sat Sep 30 14:26:41 CEST 2017


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Sep 30 13:43:02 2017 +0200| [fee6089bbf9ce63c96eab9bfdabf3eb9097a7e9c] | committer: David Fuhrmann

macosx: Allow toggling of bookmark window

This unifies behaviour with all the other HUD panels

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

 modules/gui/macosx/VLCBookmarksWindowController.h |  3 +--
 modules/gui/macosx/VLCBookmarksWindowController.m | 12 +++++++-----
 modules/gui/macosx/VLCMainMenu.m                  |  2 +-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/modules/gui/macosx/VLCBookmarksWindowController.h b/modules/gui/macosx/VLCBookmarksWindowController.h
index 4ac1c448c0..f774de732c 100644
--- a/modules/gui/macosx/VLCBookmarksWindowController.h
+++ b/modules/gui/macosx/VLCBookmarksWindowController.h
@@ -44,6 +44,7 @@
 @property (readwrite, weak) IBOutlet NSTextField *editTimeTextField;
 
 - (void)updateCocoaWindowLevel:(NSInteger)i_level;
+- (IBAction)toggleWindow:(id)sender;
 
 - (IBAction)add:(id)sender;
 - (IBAction)clear:(id)sender;
@@ -54,6 +55,4 @@
 - (IBAction)edit_cancel:(id)sender;
 - (IBAction)edit_ok:(id)sender;
 
-- (void)showBookmarks;
-
 @end
diff --git a/modules/gui/macosx/VLCBookmarksWindowController.m b/modules/gui/macosx/VLCBookmarksWindowController.m
index 09e3ea0f99..55c9cb34aa 100644
--- a/modules/gui/macosx/VLCBookmarksWindowController.m
+++ b/modules/gui/macosx/VLCBookmarksWindowController.m
@@ -102,12 +102,14 @@
         [self.window setLevel: i_level];
 }
 
-- (void)showBookmarks
+- (IBAction)toggleWindow:(id)sender
 {
-    /* show the window, called from intf.m */
-    [self.window displayIfNeeded];
-    [self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
-    [self.window makeKeyAndOrderFront:nil];
+    if ([self.window isVisible])
+        [self.window orderOut:sender];
+    else {
+        [self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
+        [self.window makeKeyAndOrderFront:sender];
+    }
 }
 
 -(void)inputChangedEvent:(NSNotification *)o_notification
diff --git a/modules/gui/macosx/VLCMainMenu.m b/modules/gui/macosx/VLCMainMenu.m
index 38b329183e..0cd78e7c25 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -1216,7 +1216,7 @@
 
 - (IBAction)showBookmarks:(id)sender
 {
-    [[[VLCMain sharedInstance] bookmarks] showBookmarks];
+    [[[VLCMain sharedInstance] bookmarks] toggleWindow:sender];
 }
 
 - (IBAction)showPreferences:(id)sender



More information about the vlc-commits mailing list