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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/devices/x11/touch_factory_x11.cc
diff --git a/ui/events/devices/x11/touch_factory_x11.cc b/ui/events/devices/x11/touch_factory_x11.cc
index 4201fa04bf3bdc35136b8400ab443280a7210df9..32596c624e98994f520c171a2ac6c4fe35436427 100644
--- a/ui/events/devices/x11/touch_factory_x11.cc
+++ b/ui/events/devices/x11/touch_factory_x11.cc
@@ -160,7 +160,22 @@ bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) {
if (event->evtype == XI_TouchBegin ||
event->evtype == XI_TouchUpdate ||
event->evtype == XI_TouchEnd) {
- return !touch_events_disabled_ && IsTouchDevice(xiev->deviceid);
+ // Since SetupXI2ForXWindow() selects events from all devices, for a
+ // touchscreen attached to a master pointer device, X11 sends two
+ // events for each touch: one from the slave (deviceid == the id of
+ // the touchscreen device), and one from the master (deviceid == the
+ // id of the master pointer device). Instead of processing both
+ // events, discard the event that comes from the slave, and only
+ // allow processing the event coming from the master.
+ // For a 'floating' touchscreen device, X11 sends only one event for
+ // each touch, with both deviceid and sourceid set to the id of the
+ // touchscreen device.
+ bool is_from_master_or_float = touch_device_list_[xiev->deviceid];
+ bool is_from_slave_device = !is_from_master_or_float
+ && xiev->sourceid == xiev->deviceid;
+ return !touch_events_disabled_ &&
+ IsTouchDevice(xiev->deviceid) &&
+ !is_from_slave_device;
}
// Make sure only key-events from the virtual core keyboard are processed.
« 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