[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:27:35 CEST 2012


vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Jun 19 01:26:03 2012 +0200| [95870a606fa60a45be516e389051ff168de2fdd4] | 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.
(cherry picked from commit fe7d94473216228c8f9667e1d476bfc54e771153)

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

 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 40e86e0..2ed6dbd 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