]> git.sesse.net Git - vlc/commitdiff
macosx: allow the user to minimize the main window by double-clicking the window...
authorFelix Paul Kühne <fkuehne@videolan.org>
Mon, 18 Jun 2012 23:26:03 +0000 (01:26 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Mon, 18 Jun 2012 23:26:03 +0000 (01:26 +0200)
This respects the system preferences' global setting.

modules/gui/macosx/MainWindowTitle.m

index 070c8b26d2161dfffd908d78ad7a297b4758ccff..55cb1f762fbc071549fa296e9693f06c4db241a6 100644 (file)
     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
 
 /*****************************************************************************