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

Side by Side 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, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/events/cocoa/events_mac_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ui/events/cocoa/cocoa_event_utils.h" 5 #import "ui/events/cocoa/cocoa_event_utils.h"
6 6
7 #include "ui/events/event_constants.h" 7 #include "ui/events/event_constants.h"
8 #include "ui/events/event_utils.h" 8 #include "ui/events/event_utils.h"
9 9
10 namespace { 10 namespace {
(...skipping 28 matching lines...) Expand all
39 flags |= (modifiers & NSAlphaShiftKeyMask) ? ui::EF_CAPS_LOCK_ON : 0; 39 flags |= (modifiers & NSAlphaShiftKeyMask) ? ui::EF_CAPS_LOCK_ON : 0;
40 flags |= (modifiers & NSShiftKeyMask) ? ui::EF_SHIFT_DOWN : 0; 40 flags |= (modifiers & NSShiftKeyMask) ? ui::EF_SHIFT_DOWN : 0;
41 flags |= (modifiers & NSControlKeyMask) ? ui::EF_CONTROL_DOWN : 0; 41 flags |= (modifiers & NSControlKeyMask) ? ui::EF_CONTROL_DOWN : 0;
42 flags |= (modifiers & NSAlternateKeyMask) ? ui::EF_ALT_DOWN : 0; 42 flags |= (modifiers & NSAlternateKeyMask) ? ui::EF_ALT_DOWN : 0;
43 flags |= (modifiers & NSCommandKeyMask) ? ui::EF_COMMAND_DOWN : 0; 43 flags |= (modifiers & NSCommandKeyMask) ? ui::EF_COMMAND_DOWN : 0;
44 return flags; 44 return flags;
45 } 45 }
46 46
47 int EventFlagsFromNSEventWithModifiers(NSEvent* event, NSUInteger modifiers) { 47 int EventFlagsFromNSEventWithModifiers(NSEvent* event, NSUInteger modifiers) {
48 int flags = EventFlagsFromModifiers(modifiers); 48 int flags = EventFlagsFromModifiers(modifiers);
49 flags |= IsLeftButtonEvent(event) ? ui::EF_LEFT_MOUSE_BUTTON : 0; 49 if (IsLeftButtonEvent(event)) {
50 // For Mac, convert Ctrl+LeftClick to a RightClick, and remove the Control
51 // key modifier.
52 if (modifiers & NSControlKeyMask)
53 flags = (flags & ~ui::EF_CONTROL_DOWN) | ui::EF_RIGHT_MOUSE_BUTTON;
54 else
55 flags |= ui::EF_LEFT_MOUSE_BUTTON;
56 }
57
50 flags |= IsRightButtonEvent(event) ? ui::EF_RIGHT_MOUSE_BUTTON : 0; 58 flags |= IsRightButtonEvent(event) ? ui::EF_RIGHT_MOUSE_BUTTON : 0;
51 flags |= IsMiddleButtonEvent(event) ? ui::EF_MIDDLE_MOUSE_BUTTON : 0; 59 flags |= IsMiddleButtonEvent(event) ? ui::EF_MIDDLE_MOUSE_BUTTON : 0;
52 return flags; 60 return flags;
53 } 61 }
54 62
55 } // namespace ui 63 } // namespace ui
OLDNEW
« 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