Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Unified Diff: ui/base/cocoa/appkit_utils.mm

Issue 1588073005: Follow El Capitan Dock settings for double-click in window title bar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cocoa/appkit_utils.mm
diff --git a/ui/base/cocoa/appkit_utils.mm b/ui/base/cocoa/appkit_utils.mm
index 6aa90ae6789d1dcb58f9b87ee753d1576db4f1f0..66ae924e12963426672f2886667c40dc45e5bc28 100644
--- a/ui/base/cocoa/appkit_utils.mm
+++ b/ui/base/cocoa/appkit_utils.mm
@@ -29,6 +29,22 @@ bool ShouldWindowsMiniaturizeOnDoubleClick() {
[NSWindow performSelector:@selector(_shouldMiniaturizeOnDoubleClick)];
}
+// Whether windows should maximize on a double-click on the title bar.
+bool ShouldWindowsMaximizeOnDoubleClick() {
+ // Pre-Yosmite the answer was "no."
+ if (!base::mac::IsOSYosemiteOrLater()) {
tapted 2016/01/17 23:53:18 nit: IsOSMavericksOrEarlier() ?
shrike 2016/01/19 19:34:23 I guess I like !IsOSYosemiteOrLater() because the
tapted 2016/01/19 22:16:34 Makes sense, and I agree with your point. (and I'm
shrike 2016/01/20 17:23:54 Yeah, that makes a lot of sense, and has nice symm
+ return false;
+ } else if (base::mac::IsOSYosemite()) {
+ return true;
+ }
+
+ // In El Capitan there's a Dock setting that governs the action.
tapted 2016/01/17 23:53:18 nit: Maybe something like "El Capitan introduced a
shrike 2016/01/19 19:34:23 Good point. I added your comment language, and als
+ NSString* doubleClickAction = [[NSUserDefaults standardUserDefaults]
+ objectForKey:@"AppleActionOnDoubleClick"];
+
+ return [doubleClickAction isEqualToString:@"Maximize"];
+}
+
} // namespace
namespace ui {
@@ -56,7 +72,7 @@ void DrawNinePartImage(NSRect frame,
void WindowTitlebarReceivedDoubleClick(NSWindow* window, id sender) {
if (ShouldWindowsMiniaturizeOnDoubleClick()) {
[window performMiniaturize:sender];
- } else if (base::mac::IsOSYosemiteOrLater()) {
+ } else if (ShouldWindowsMaximizeOnDoubleClick()) {
[window performZoom:sender];
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698