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 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 public: | 43 public: |
44 EventModifiersEvdev(); | 44 EventModifiersEvdev(); |
45 ~EventModifiersEvdev(); | 45 ~EventModifiersEvdev(); |
46 | 46 |
47 // Record key press or release for regular modifier key (shift, alt, etc). | 47 // Record key press or release for regular modifier key (shift, alt, etc). |
48 void UpdateModifier(unsigned int modifier, bool down); | 48 void UpdateModifier(unsigned int modifier, bool down); |
49 | 49 |
50 // Record key press or release for locking modifier key (caps lock). | 50 // Record key press or release for locking modifier key (caps lock). |
51 void UpdateModifierLock(unsigned int modifier, bool down); | 51 void UpdateModifierLock(unsigned int modifier, bool down); |
52 | 52 |
| 53 // Directly set the state of a locking modifier key (caps lock). |
| 54 void SetModifierLock(unsigned int modifier, bool locked); |
| 55 |
53 // Return current flags to use for incoming events. | 56 // Return current flags to use for incoming events. |
54 int GetModifierFlags(); | 57 int GetModifierFlags(); |
55 | 58 |
56 // Return the mask for the specified modifier. | 59 // Return the mask for the specified modifier. |
57 static int GetEventFlagFromModifier(unsigned int modifier); | 60 static int GetEventFlagFromModifier(unsigned int modifier); |
58 | 61 |
59 private: | 62 private: |
60 // Count of keys pressed for each modifier. | 63 // Count of keys pressed for each modifier. |
61 int modifiers_down_[EVDEV_NUM_MODIFIERS]; | 64 int modifiers_down_[EVDEV_NUM_MODIFIERS]; |
62 | 65 |
63 // Mask of modifier flags currently "locked". | 66 // Mask of modifier flags currently "locked". |
64 int modifier_flags_locked_; | 67 int modifier_flags_locked_; |
65 | 68 |
66 // Mask of modifier flags currently active (nonzero keys pressed xor locked). | 69 // Mask of modifier flags currently active (nonzero keys pressed xor locked). |
67 int modifier_flags_; | 70 int modifier_flags_; |
68 | 71 |
69 // Update modifier_flags_ from modifiers_down_ and modifier_flags_locked_. | 72 // Update modifier_flags_ from modifiers_down_ and modifier_flags_locked_. |
70 void UpdateFlags(unsigned int modifier); | 73 void UpdateFlags(unsigned int modifier); |
71 | 74 |
72 DISALLOW_COPY_AND_ASSIGN(EventModifiersEvdev); | 75 DISALLOW_COPY_AND_ASSIGN(EventModifiersEvdev); |
73 }; | 76 }; |
74 | 77 |
75 } // namspace ui | 78 } // namspace ui |
76 | 79 |
77 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_MODIFIERS_EVDEV_H_ | 80 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_MODIFIERS_EVDEV_H_ |
OLD | NEW |