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

Side by Side Diff: ui/events/cocoa/cocoa_event_utils.mm

Issue 160083003: Split cocoa_event_utils in two parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/base/cocoa/cocoa_event_utils.h" 5 #import "ui/events/cocoa/cocoa_event_utils.h"
6 6
7 #include "ui/base/window_open_disposition.h"
8 #include "ui/events/event_constants.h" 7 #include "ui/events/event_constants.h"
9 8
10 namespace { 9 namespace {
11 10
12 bool isLeftButtonEvent(NSEvent* event) { 11 bool isLeftButtonEvent(NSEvent* event) {
13 NSEventType type = [event type]; 12 NSEventType type = [event type];
14 return type == NSLeftMouseDown || 13 return type == NSLeftMouseDown ||
15 type == NSLeftMouseDragged || 14 type == NSLeftMouseDragged ||
16 type == NSLeftMouseUp; 15 type == NSLeftMouseUp;
17 } 16 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 flags |= (modifiers & NSShiftKeyMask) ? ui::EF_SHIFT_DOWN : 0; 48 flags |= (modifiers & NSShiftKeyMask) ? ui::EF_SHIFT_DOWN : 0;
50 flags |= (modifiers & NSControlKeyMask) ? ui::EF_CONTROL_DOWN : 0; 49 flags |= (modifiers & NSControlKeyMask) ? ui::EF_CONTROL_DOWN : 0;
51 flags |= (modifiers & NSAlternateKeyMask) ? ui::EF_ALT_DOWN : 0; 50 flags |= (modifiers & NSAlternateKeyMask) ? ui::EF_ALT_DOWN : 0;
52 flags |= (modifiers & NSCommandKeyMask) ? ui::EF_COMMAND_DOWN : 0; 51 flags |= (modifiers & NSCommandKeyMask) ? ui::EF_COMMAND_DOWN : 0;
53 flags |= isLeftButtonEvent(event) ? ui::EF_LEFT_MOUSE_BUTTON : 0; 52 flags |= isLeftButtonEvent(event) ? ui::EF_LEFT_MOUSE_BUTTON : 0;
54 flags |= isRightButtonEvent(event) ? ui::EF_RIGHT_MOUSE_BUTTON : 0; 53 flags |= isRightButtonEvent(event) ? ui::EF_RIGHT_MOUSE_BUTTON : 0;
55 flags |= isMiddleButtonEvent(event) ? ui::EF_MIDDLE_MOUSE_BUTTON : 0; 54 flags |= isMiddleButtonEvent(event) ? ui::EF_MIDDLE_MOUSE_BUTTON : 0;
56 return flags; 55 return flags;
57 } 56 }
58 57
59 WindowOpenDisposition WindowOpenDispositionFromNSEvent(NSEvent* event) {
60 NSUInteger modifiers = [event modifierFlags];
61 return WindowOpenDispositionFromNSEventWithFlags(event, modifiers);
62 }
63
64 WindowOpenDisposition WindowOpenDispositionFromNSEventWithFlags(
65 NSEvent* event, NSUInteger modifiers) {
66 int event_flags = EventFlagsFromNSEventWithModifiers(event, modifiers);
67 return ui::DispositionFromEventFlags(event_flags);
68 }
69
70 } // namespace ui 58 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698