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

Side by Side Diff: ui/events/devices/x11/touch_factory_x11.cc

Issue 968343002: Make the native select menu work on Linux touch screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | ui/views/widget/desktop_aura/x11_pointer_grab.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 (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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 154
155 bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) { 155 bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) {
156 DCHECK_EQ(GenericEvent, xev->type); 156 DCHECK_EQ(GenericEvent, xev->type);
157 XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data); 157 XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data);
158 XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event); 158 XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event);
159 159
160 if (event->evtype == XI_TouchBegin || 160 if (event->evtype == XI_TouchBegin ||
161 event->evtype == XI_TouchUpdate || 161 event->evtype == XI_TouchUpdate ||
162 event->evtype == XI_TouchEnd) { 162 event->evtype == XI_TouchEnd) {
163 return !touch_events_disabled_ && IsTouchDevice(xiev->deviceid); 163 return !touch_events_disabled_ &&
164 IsTouchDevice(xiev->deviceid) && (xiev->sourceid == xiev->deviceid);
sadrul 2015/03/04 06:02:29 Add a comment here explaining the sourceid == devi
lanwei 2015/03/04 15:46:06 Done.
164 } 165 }
165 166
166 // Make sure only key-events from the virtual core keyboard are processed. 167 // Make sure only key-events from the virtual core keyboard are processed.
167 if (event->evtype == XI_KeyPress || event->evtype == XI_KeyRelease) { 168 if (event->evtype == XI_KeyPress || event->evtype == XI_KeyRelease) {
168 return (virtual_core_keyboard_device_ < 0) || 169 return (virtual_core_keyboard_device_ < 0) ||
169 (virtual_core_keyboard_device_ == xiev->deviceid); 170 (virtual_core_keyboard_device_ == xiev->deviceid);
170 } 171 }
171 172
172 if (event->evtype != XI_ButtonPress && 173 if (event->evtype != XI_ButtonPress &&
173 event->evtype != XI_ButtonRelease && 174 event->evtype != XI_ButtonRelease &&
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 if (ptr[0] || ptr[1]) 325 if (ptr[0] || ptr[1])
325 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1])); 326 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1]));
326 } 327 }
327 XFree(prop_return); 328 XFree(prop_return);
328 } 329 }
329 330
330 XCloseDevice(display, device); 331 XCloseDevice(display, device);
331 } 332 }
332 333
333 } // namespace ui 334 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/desktop_aura/x11_pointer_grab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698