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

Side by Side Diff: ui/events/test/events_test_utils_x11.cc

Issue 1559163002: Clean up event flags a bit: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 4 years, 11 months 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/ozone/layout/xkb/xkb_keyboard_layout_engine.cc ('k') | ui/events/win/events_win.cc » ('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 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
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
OLDNEW
« no previous file with comments | « ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc ('k') | ui/events/win/events_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698