[vlc-commits] macosx: allow the user to minimize the main window by double-clicking the window title when using the dark UI variant

Felix Paul Kühne git at videolan.org
Tue Jun 19 01:26:13 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Jun 19 01:26:03 2012 +0200| [fe7d94473216228c8f9667e1d476bfc54e771153] | committer: Felix Paul Kühne

macosx: allow the user to minimize the main window by double-clicking the window title when using the dark UI variant

This respects the system preferences' global setting.

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

 modules/gui/macosx/MainWindowTitle.m |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/modules/gui/macosx/MainWindowTitle.m b/modules/gui/macosx/MainWindowTitle.m
index 070c8b2..55cb1f7 100644
--- a/modules/gui/macosx/MainWindowTitle.m
+++ b/modules/gui/macosx/MainWindowTitle.m
@@ -240,6 +240,19 @@
     else
         [o_fullscreen_btn setImage: [NSImage imageNamed:@"window-fullscreen"]];
 }
+
+- (void)mouseUp:(NSEvent *)event
+{
+    if ([event clickCount] == 2) {
+        //Get settings from "System Preferences" >  "Appearance" > "Double-click on windows title bar to minimize"
+        NSString *const MDAppleMiniaturizeOnDoubleClickKey = @"AppleMiniaturizeOnDoubleClick";
+        NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
+        [userDefaults addSuiteNamed:NSGlobalDomain];
+
+        if ([[userDefaults objectForKey:MDAppleMiniaturizeOnDoubleClickKey] boolValue])
+            [[self window] miniaturize:self];
+    }
+}
 @end
 
 /*****************************************************************************



More information about the vlc-commits mailing list