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

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

Issue 2439953005: Support NSFlagsChanged in ui::EventFromNative. (Closed)
Patch Set: Unify NSFlagsChanged handling between content and ui/events. Created 4 years, 1 month 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 | « ui/events/cocoa/cocoa_event_utils.mm ('k') | 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 #include "ui/events/event_utils.h" 5 #include "ui/events/event_utils.h"
6 6
7 #include <Cocoa/Cocoa.h> 7 #include <Cocoa/Cocoa.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #import "base/mac/mac_util.h" 11 #import "base/mac/mac_util.h"
12 #import "base/mac/sdk_forward_declarations.h" 12 #import "base/mac/sdk_forward_declarations.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "ui/events/base_event_utils.h" 15 #include "ui/events/base_event_utils.h"
16 #include "ui/events/cocoa/cocoa_event_utils.h" 16 #include "ui/events/cocoa/cocoa_event_utils.h"
17 #include "ui/events/event_utils.h" 17 #include "ui/events/event_utils.h"
18 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" 18 #import "ui/events/keycodes/keyboard_code_conversion_mac.h"
19 #include "ui/gfx/geometry/point.h" 19 #include "ui/gfx/geometry/point.h"
20 #include "ui/gfx/geometry/vector2d.h" 20 #include "ui/gfx/geometry/vector2d.h"
21 21
22 namespace ui { 22 namespace ui {
23 23
24 EventType EventTypeFromNative(const base::NativeEvent& native_event) { 24 EventType EventTypeFromNative(const base::NativeEvent& native_event) {
25 NSEventType type = [native_event type]; 25 NSEventType type = [native_event type];
26 switch (type) { 26 switch (type) {
27 case NSKeyDown: 27 case NSKeyDown:
28 return ET_KEY_PRESSED;
29 case NSKeyUp: 28 case NSKeyUp:
30 return ET_KEY_RELEASED; 29 case NSFlagsChanged:
30 return IsKeyUpEvent(native_event) ? ET_KEY_RELEASED : ET_KEY_PRESSED;
31 case NSLeftMouseDown: 31 case NSLeftMouseDown:
32 case NSRightMouseDown: 32 case NSRightMouseDown:
33 case NSOtherMouseDown: 33 case NSOtherMouseDown:
34 return ET_MOUSE_PRESSED; 34 return ET_MOUSE_PRESSED;
35 case NSLeftMouseUp: 35 case NSLeftMouseUp:
36 case NSRightMouseUp: 36 case NSRightMouseUp:
37 case NSOtherMouseUp: 37 case NSOtherMouseUp:
38 return ET_MOUSE_RELEASED; 38 return ET_MOUSE_RELEASED;
39 case NSLeftMouseDragged: 39 case NSLeftMouseDragged:
40 case NSRightMouseDragged: 40 case NSRightMouseDragged:
41 case NSOtherMouseDragged: 41 case NSOtherMouseDragged:
42 return ET_MOUSE_DRAGGED; 42 return ET_MOUSE_DRAGGED;
43 case NSMouseMoved: 43 case NSMouseMoved:
44 return ET_MOUSE_MOVED; 44 return ET_MOUSE_MOVED;
45 case NSScrollWheel: 45 case NSScrollWheel:
46 return ET_SCROLL; 46 return ET_SCROLL;
47 case NSMouseEntered: 47 case NSMouseEntered:
48 return ET_MOUSE_ENTERED; 48 return ET_MOUSE_ENTERED;
49 case NSMouseExited: 49 case NSMouseExited:
50 return ET_MOUSE_EXITED; 50 return ET_MOUSE_EXITED;
51 case NSEventTypeSwipe: 51 case NSEventTypeSwipe:
52 return ET_SCROLL_FLING_START; 52 return ET_SCROLL_FLING_START;
53 case NSAppKitDefined: 53 case NSAppKitDefined:
54 case NSSystemDefined: 54 case NSSystemDefined:
55 return ET_UNKNOWN; 55 return ET_UNKNOWN;
56 case NSFlagsChanged:
57 case NSApplicationDefined: 56 case NSApplicationDefined:
58 case NSPeriodic: 57 case NSPeriodic:
59 case NSCursorUpdate: 58 case NSCursorUpdate:
60 case NSTabletPoint: 59 case NSTabletPoint:
61 case NSTabletProximity: 60 case NSTabletProximity:
62 case NSEventTypeGesture: 61 case NSEventTypeGesture:
63 case NSEventTypeMagnify: 62 case NSEventTypeMagnify:
64 case NSEventTypeRotate: 63 case NSEventTypeRotate:
65 case NSEventTypeBeginGesture: 64 case NSEventTypeBeginGesture:
66 case NSEventTypeEndGesture: 65 case NSEventTypeEndGesture:
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 uint16_t return_value; 299 uint16_t return_value;
301 [text getCharacters:&return_value]; 300 [text getCharacters:&return_value];
302 return return_value; 301 return return_value;
303 } 302 }
304 303
305 bool IsCharFromNative(const base::NativeEvent& native_event) { 304 bool IsCharFromNative(const base::NativeEvent& native_event) {
306 return false; 305 return false;
307 } 306 }
308 307
309 } // namespace ui 308 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/cocoa/cocoa_event_utils.mm ('k') | ui/events/cocoa/events_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698