OLD | NEW |
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 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_MODIFIERS_EVDEV_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_MODIFIERS_EVDEV_H_ |
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_MODIFIERS_EVDEV_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_MODIFIERS_EVDEV_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 9 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
13 enum { | 13 enum { |
14 EVDEV_MODIFIER_NONE, | 14 EVDEV_MODIFIER_NONE, |
15 EVDEV_MODIFIER_CAPS_LOCK, | 15 EVDEV_MODIFIER_CAPS_LOCK_HELD, |
| 16 EVDEV_MODIFIER_CAPS_LOCKED_STATE, |
16 EVDEV_MODIFIER_SHIFT, | 17 EVDEV_MODIFIER_SHIFT, |
17 EVDEV_MODIFIER_CONTROL, | 18 EVDEV_MODIFIER_CONTROL, |
18 EVDEV_MODIFIER_ALT, | 19 EVDEV_MODIFIER_ALT, |
19 EVDEV_MODIFIER_LEFT_MOUSE_BUTTON, | 20 EVDEV_MODIFIER_LEFT_MOUSE_BUTTON, |
20 EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON, | 21 EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON, |
21 EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON, | 22 EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON, |
22 EVDEV_MODIFIER_COMMAND, | 23 EVDEV_MODIFIER_COMMAND, |
23 EVDEV_MODIFIER_ALTGR, | 24 EVDEV_MODIFIER_ALTGR, |
24 EVDEV_NUM_MODIFIERS | 25 EVDEV_NUM_MODIFIERS |
25 }; | 26 }; |
(...skipping 23 matching lines...) Expand all Loading... |
49 | 50 |
50 // Record key press or release for locking modifier key (caps lock). | 51 // Record key press or release for locking modifier key (caps lock). |
51 void UpdateModifierLock(unsigned int modifier, bool down); | 52 void UpdateModifierLock(unsigned int modifier, bool down); |
52 | 53 |
53 // Directly set the state of a locking modifier key (caps lock). | 54 // Directly set the state of a locking modifier key (caps lock). |
54 void SetModifierLock(unsigned int modifier, bool locked); | 55 void SetModifierLock(unsigned int modifier, bool locked); |
55 | 56 |
56 // Return current flags to use for incoming events. | 57 // Return current flags to use for incoming events. |
57 int GetModifierFlags(); | 58 int GetModifierFlags(); |
58 | 59 |
| 60 // Return current flags that are "locked". |
| 61 int GetModifierLockFlags(); |
| 62 |
59 // Return the mask for the specified modifier. | 63 // Return the mask for the specified modifier. |
60 static int GetEventFlagFromModifier(unsigned int modifier); | 64 static int GetEventFlagFromModifier(unsigned int modifier); |
61 | 65 |
62 private: | 66 private: |
63 // Count of keys pressed for each modifier. | 67 // Count of keys pressed for each modifier. |
64 int modifiers_down_[EVDEV_NUM_MODIFIERS]; | 68 int modifiers_down_[EVDEV_NUM_MODIFIERS]; |
65 | 69 |
66 // Mask of modifier flags currently "locked". | 70 // Mask of modifier flags currently "locked". |
67 int modifier_flags_locked_; | 71 int modifier_flags_locked_; |
68 | 72 |
69 // Mask of modifier flags currently active (nonzero keys pressed xor locked). | 73 // Mask of modifier flags currently active (nonzero keys pressed xor locked). |
70 int modifier_flags_; | 74 int modifier_flags_; |
71 | 75 |
72 // Update modifier_flags_ from modifiers_down_ and modifier_flags_locked_. | 76 // Update modifier_flags_ from modifiers_down_ and modifier_flags_locked_. |
73 void UpdateFlags(unsigned int modifier); | 77 void UpdateFlags(unsigned int modifier); |
74 | 78 |
75 DISALLOW_COPY_AND_ASSIGN(EventModifiersEvdev); | 79 DISALLOW_COPY_AND_ASSIGN(EventModifiersEvdev); |
76 }; | 80 }; |
77 | 81 |
78 } // namspace ui | 82 } // namspace ui |
79 | 83 |
80 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_MODIFIERS_EVDEV_H_ | 84 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_MODIFIERS_EVDEV_H_ |
OLD | NEW |