OLD | NEW |
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 #include "ui/events/test/events_test_utils_x11.h" | 5 #include "ui/events/test/events_test_utils_x11.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <X11/extensions/XI2.h> | 8 #include <X11/extensions/XI2.h> |
9 #include <X11/keysym.h> | 9 #include <X11/keysym.h> |
10 #include <X11/X.h> | 10 #include <X11/X.h> |
11 #include <X11/Xlib.h> | 11 #include <X11/Xlib.h> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "ui/events/devices/x11/touch_factory_x11.h" | 15 #include "ui/events/devices/x11/touch_factory_x11.h" |
16 #include "ui/events/event_constants.h" | 16 #include "ui/events/event_constants.h" |
17 #include "ui/events/event_utils.h" | 17 #include "ui/events/event_utils.h" |
18 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 18 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Converts ui::EventType to state for X*Events. | 22 // Converts ui::EventType to state for X*Events. |
23 unsigned int XEventState(int flags) { | 23 unsigned int XEventState(int flags) { |
24 return | 24 return |
25 ((flags & ui::EF_SHIFT_DOWN) ? ShiftMask : 0) | | 25 ((flags & ui::EF_SHIFT_DOWN) ? ShiftMask : 0) | |
| 26 ((flags & ui::EF_CAPS_LOCK_ON) ? LockMask : 0) | |
26 ((flags & ui::EF_CONTROL_DOWN) ? ControlMask : 0) | | 27 ((flags & ui::EF_CONTROL_DOWN) ? ControlMask : 0) | |
27 ((flags & ui::EF_ALT_DOWN) ? Mod1Mask : 0) | | 28 ((flags & ui::EF_ALT_DOWN) ? Mod1Mask : 0) | |
28 ((flags & ui::EF_NUM_LOCK_DOWN) ? Mod2Mask : 0) | | 29 ((flags & ui::EF_NUM_LOCK_ON) ? Mod2Mask : 0) | |
29 ((flags & ui::EF_CAPS_LOCK_DOWN) ? LockMask : 0) | | 30 ((flags & ui::EF_MOD3_DOWN) ? Mod3Mask : 0) | |
| 31 ((flags & ui::EF_COMMAND_DOWN) ? Mod4Mask : 0) | |
30 ((flags & ui::EF_ALTGR_DOWN) ? Mod5Mask : 0) | | 32 ((flags & ui::EF_ALTGR_DOWN) ? Mod5Mask : 0) | |
31 ((flags & ui::EF_COMMAND_DOWN) ? Mod4Mask : 0) | | |
32 ((flags & ui::EF_MOD3_DOWN) ? Mod3Mask : 0) | | |
33 ((flags & ui::EF_LEFT_MOUSE_BUTTON) ? Button1Mask: 0) | | 33 ((flags & ui::EF_LEFT_MOUSE_BUTTON) ? Button1Mask: 0) | |
34 ((flags & ui::EF_MIDDLE_MOUSE_BUTTON) ? Button2Mask: 0) | | 34 ((flags & ui::EF_MIDDLE_MOUSE_BUTTON) ? Button2Mask: 0) | |
35 ((flags & ui::EF_RIGHT_MOUSE_BUTTON) ? Button3Mask: 0); | 35 ((flags & ui::EF_RIGHT_MOUSE_BUTTON) ? Button3Mask: 0); |
36 } | 36 } |
37 | 37 |
38 // Converts EventType to XKeyEvent type. | 38 // Converts EventType to XKeyEvent type. |
39 int XKeyEventType(ui::EventType type) { | 39 int XKeyEventType(ui::EventType type) { |
40 switch (type) { | 40 switch (type) { |
41 case ui::ET_KEY_PRESSED: | 41 case ui::ET_KEY_PRESSED: |
42 return KeyPress; | 42 return KeyPress; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 328 } |
329 | 329 |
330 void SetUpPointerDevicesForTest(const std::vector<int>& devices) { | 330 void SetUpPointerDevicesForTest(const std::vector<int>& devices) { |
331 TouchFactory::GetInstance()->SetPointerDeviceForTest(devices); | 331 TouchFactory::GetInstance()->SetPointerDeviceForTest(devices); |
332 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); | 332 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); |
333 manager->SetDeviceListForTest(std::vector<int>(), std::vector<int>(), | 333 manager->SetDeviceListForTest(std::vector<int>(), std::vector<int>(), |
334 devices); | 334 devices); |
335 } | 335 } |
336 | 336 |
337 } // namespace ui | 337 } // namespace ui |
OLD | NEW |