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

Unified Diff: ui/events/cocoa/cocoa_event_utils.mm

Issue 2025943003: MacViews: Treat Ctrl+LeftClick as RightClick on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160520-Enums-MakeThemInt-HeaderChanges-ROLLUP
Patch Set: Remove control flag Created 4 years, 7 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 | ui/events/cocoa/events_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/cocoa/cocoa_event_utils.mm
diff --git a/ui/events/cocoa/cocoa_event_utils.mm b/ui/events/cocoa/cocoa_event_utils.mm
index ea1bd550d96f16db1349bb5b208a0c4c8a2307f3..81caa7ad3f2d4a97f03b799b70d3d510905c4f3b 100644
--- a/ui/events/cocoa/cocoa_event_utils.mm
+++ b/ui/events/cocoa/cocoa_event_utils.mm
@@ -46,7 +46,15 @@ int EventFlagsFromModifiers(NSUInteger modifiers) {
int EventFlagsFromNSEventWithModifiers(NSEvent* event, NSUInteger modifiers) {
int flags = EventFlagsFromModifiers(modifiers);
- flags |= IsLeftButtonEvent(event) ? ui::EF_LEFT_MOUSE_BUTTON : 0;
+ if (IsLeftButtonEvent(event)) {
+ // For Mac, convert Ctrl+LeftClick to a RightClick, and remove the Control
+ // key modifier.
+ if (modifiers & NSControlKeyMask)
+ flags = (flags & ~ui::EF_CONTROL_DOWN) | ui::EF_RIGHT_MOUSE_BUTTON;
+ else
+ flags |= ui::EF_LEFT_MOUSE_BUTTON;
+ }
+
flags |= IsRightButtonEvent(event) ? ui::EF_RIGHT_MOUSE_BUTTON : 0;
flags |= IsMiddleButtonEvent(event) ? ui::EF_MIDDLE_MOUSE_BUTTON : 0;
return flags;
« no previous file with comments | « no previous file | ui/events/cocoa/events_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698