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 <X11/extensions/XI2.h> | 7 #include <X11/extensions/XI2.h> |
8 #include <X11/keysym.h> | 8 #include <X11/keysym.h> |
9 #include <X11/X.h> | 9 #include <X11/X.h> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 event->xcookie.data = new XIDeviceEvent; | 102 event->xcookie.data = new XIDeviceEvent; |
103 XIDeviceEvent* xiev = | 103 XIDeviceEvent* xiev = |
104 static_cast<XIDeviceEvent*>(event->xcookie.data); | 104 static_cast<XIDeviceEvent*>(event->xcookie.data); |
105 memset(xiev, 0, sizeof(XIDeviceEvent)); | 105 memset(xiev, 0, sizeof(XIDeviceEvent)); |
106 xiev->deviceid = deviceid; | 106 xiev->deviceid = deviceid; |
107 xiev->sourceid = deviceid; | 107 xiev->sourceid = deviceid; |
108 xiev->evtype = evtype; | 108 xiev->evtype = evtype; |
109 xiev->detail = tracking_id; | 109 xiev->detail = tracking_id; |
110 xiev->event_x = location.x(); | 110 xiev->event_x = location.x(); |
111 xiev->event_y = location.y(); | 111 xiev->event_y = location.y(); |
| 112 xiev->event = DefaultRootWindow(gfx::GetXDisplay()); |
112 if (evtype == XI_ButtonPress || evtype == XI_ButtonRelease) { | 113 if (evtype == XI_ButtonPress || evtype == XI_ButtonRelease) { |
113 xiev->buttons.mask_len = 8; | 114 xiev->buttons.mask_len = 8; |
114 xiev->buttons.mask = new unsigned char[xiev->buttons.mask_len]; | 115 xiev->buttons.mask = new unsigned char[xiev->buttons.mask_len]; |
115 memset(xiev->buttons.mask, 0, xiev->buttons.mask_len); | 116 memset(xiev->buttons.mask, 0, xiev->buttons.mask_len); |
116 } | 117 } |
117 return event; | 118 return event; |
118 } | 119 } |
119 | 120 |
120 } // namespace | 121 } // namespace |
121 | 122 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 manager->SetDeviceListForTest(std::vector<unsigned int>(), device_list); | 258 manager->SetDeviceListForTest(std::vector<unsigned int>(), device_list); |
258 } | 259 } |
259 | 260 |
260 void SetUpTouchDevicesForTest(const std::vector<unsigned int>& devices) { | 261 void SetUpTouchDevicesForTest(const std::vector<unsigned int>& devices) { |
261 TouchFactory::GetInstance()->SetTouchDeviceForTest(devices); | 262 TouchFactory::GetInstance()->SetTouchDeviceForTest(devices); |
262 ui::DeviceDataManager* manager = ui::DeviceDataManager::GetInstance(); | 263 ui::DeviceDataManager* manager = ui::DeviceDataManager::GetInstance(); |
263 manager->SetDeviceListForTest(devices, std::vector<unsigned int>()); | 264 manager->SetDeviceListForTest(devices, std::vector<unsigned int>()); |
264 } | 265 } |
265 | 266 |
266 } // namespace ui | 267 } // namespace ui |
OLD | NEW |