OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/devices/x11/touch_factory_x11.h" | 5 #include "ui/events/devices/x11/touch_factory_x11.h" |
6 | 6 |
7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
8 #include <X11/cursorfont.h> | 8 #include <X11/cursorfont.h> |
9 #include <X11/extensions/XInput.h> | 9 #include <X11/extensions/XInput.h> |
10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 reinterpret_cast<XITouchClassInfo*>(xiclassinfo); | 149 reinterpret_cast<XITouchClassInfo*>(xiclassinfo); |
150 // Only care direct touch device (such as touch screen) right now | 150 // Only care direct touch device (such as touch screen) right now |
151 if (tci->mode == XIDirectTouch) | 151 if (tci->mode == XIDirectTouch) |
152 CacheTouchscreenIds(display, devinfo->deviceid); | 152 CacheTouchscreenIds(display, devinfo->deviceid); |
153 } | 153 } |
154 } | 154 } |
155 } | 155 } |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) { | 159 bool TouchFactory::ShouldProcessXI2Event(const XEvent* xev) { |
160 DCHECK_EQ(GenericEvent, xev->type); | 160 DCHECK_EQ(GenericEvent, xev->type); |
161 XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data); | 161 const XIEvent* event = static_cast<const XIEvent*>(xev->xcookie.data); |
162 XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event); | 162 const XIDeviceEvent* xiev = reinterpret_cast<const XIDeviceEvent*>(event); |
163 | 163 |
164 if (event->evtype == XI_TouchBegin || | 164 if (event->evtype == XI_TouchBegin || |
165 event->evtype == XI_TouchUpdate || | 165 event->evtype == XI_TouchUpdate || |
166 event->evtype == XI_TouchEnd) { | 166 event->evtype == XI_TouchEnd) { |
167 return !touch_events_disabled_ && IsTouchDevice(xiev->deviceid); | 167 return !touch_events_disabled_ && IsTouchDevice(xiev->deviceid); |
168 } | 168 } |
169 | 169 |
170 // Make sure only key-events from the virtual core keyboard are processed. | 170 // Make sure only key-events from the virtual core keyboard are processed. |
171 if (event->evtype == XI_KeyPress || event->evtype == XI_KeyRelease) { | 171 if (event->evtype == XI_KeyPress || event->evtype == XI_KeyRelease) { |
172 return (virtual_core_keyboard_device_ < 0) || | 172 return (virtual_core_keyboard_device_ < 0) || |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 if (ptr[0] || ptr[1]) | 338 if (ptr[0] || ptr[1]) |
339 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1])); | 339 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1])); |
340 } | 340 } |
341 XFree(prop_return); | 341 XFree(prop_return); |
342 } | 342 } |
343 | 343 |
344 XCloseDevice(display, device); | 344 XCloseDevice(display, device); |
345 } | 345 } |
346 | 346 |
347 } // namespace ui | 347 } // namespace ui |
OLD | NEW |