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 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" | 5 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" |
6 | 6 |
7 #include <linux/input.h> | 7 #include <linux/input.h> |
8 | 8 |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 static const int kEventFlagFromModifiers[] = { | 15 static const int kEventFlagFromModifiers[] = { |
16 EF_NONE, // EVDEV_MODIFIER_NONE, | 16 EF_NONE, // EVDEV_MODIFIER_NONE, |
17 EF_CAPS_LOCK_DOWN, // EVDEV_MODIFIER_CAPS_LOCK | 17 EF_MOD3_DOWN, // EVDEV_MODIFIER_CAPS_LOCK_HELD |
| 18 EF_CAPS_LOCK_DOWN, // EVDEV_MODIFIER_CAPS_LOCKED_STATE |
18 EF_SHIFT_DOWN, // EVDEV_MODIFIER_SHIFT | 19 EF_SHIFT_DOWN, // EVDEV_MODIFIER_SHIFT |
19 EF_CONTROL_DOWN, // EVDEV_MODIFIER_CONTROL | 20 EF_CONTROL_DOWN, // EVDEV_MODIFIER_CONTROL |
20 EF_ALT_DOWN, // EVDEV_MODIFIER_ALT | 21 EF_ALT_DOWN, // EVDEV_MODIFIER_ALT |
21 EF_LEFT_MOUSE_BUTTON, // EVDEV_MODIFIER_LEFT_MOUSE_BUTTON | 22 EF_LEFT_MOUSE_BUTTON, // EVDEV_MODIFIER_LEFT_MOUSE_BUTTON |
22 EF_MIDDLE_MOUSE_BUTTON, // EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON | 23 EF_MIDDLE_MOUSE_BUTTON, // EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON |
23 EF_RIGHT_MOUSE_BUTTON, // EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON | 24 EF_RIGHT_MOUSE_BUTTON, // EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON |
24 EF_COMMAND_DOWN, // EVDEV_MODIFIER_COMMAND | 25 EF_COMMAND_DOWN, // EVDEV_MODIFIER_COMMAND |
25 EF_ALTGR_DOWN, // EVDEV_MODIFIER_ALTGR | 26 EF_ALTGR_DOWN, // EVDEV_MODIFIER_ALTGR |
26 }; | 27 }; |
27 | 28 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 bool down = modifiers_down_[modifier]; | 78 bool down = modifiers_down_[modifier]; |
78 bool locked = (modifier_flags_locked_ & mask); | 79 bool locked = (modifier_flags_locked_ & mask); |
79 if (down != locked) | 80 if (down != locked) |
80 modifier_flags_ |= mask; | 81 modifier_flags_ |= mask; |
81 else | 82 else |
82 modifier_flags_ &= ~mask; | 83 modifier_flags_ &= ~mask; |
83 } | 84 } |
84 | 85 |
85 int EventModifiersEvdev::GetModifierFlags() { return modifier_flags_; } | 86 int EventModifiersEvdev::GetModifierFlags() { return modifier_flags_; } |
86 | 87 |
| 88 int EventModifiersEvdev::GetModifierLockFlags() { |
| 89 return modifier_flags_locked_; |
| 90 } |
| 91 |
87 // static | 92 // static |
88 int EventModifiersEvdev::GetEventFlagFromModifier(unsigned int modifier) { | 93 int EventModifiersEvdev::GetEventFlagFromModifier(unsigned int modifier) { |
89 return kEventFlagFromModifiers[modifier]; | 94 return kEventFlagFromModifiers[modifier]; |
90 } | 95 } |
91 | 96 |
92 } // namespace ui | 97 } // namespace ui |
OLD | NEW |