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

Side by Side Diff: ui/events/x/touch_factory_x11.cc

Issue 402763002: x11: Make sure each XI2 key-event is not processed twice. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/x/touch_factory_x11.h" 5 #include "ui/events/x/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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data); 167 XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data);
168 XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event); 168 XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event);
169 169
170 #if defined(USE_XI2_MT) 170 #if defined(USE_XI2_MT)
171 if (event->evtype == XI_TouchBegin || 171 if (event->evtype == XI_TouchBegin ||
172 event->evtype == XI_TouchUpdate || 172 event->evtype == XI_TouchUpdate ||
173 event->evtype == XI_TouchEnd) { 173 event->evtype == XI_TouchEnd) {
174 return !touch_events_disabled_ && IsTouchDevice(xiev->deviceid); 174 return !touch_events_disabled_ && IsTouchDevice(xiev->deviceid);
175 } 175 }
176 #endif 176 #endif
177 // Make sure only key-events from the master device are processed.
178 if (event->evtype == XI_KeyPress || event->evtype == XI_KeyRelease)
179 return xiev->deviceid == xiev->sourceid;
180
177 if (event->evtype != XI_ButtonPress && 181 if (event->evtype != XI_ButtonPress &&
178 event->evtype != XI_ButtonRelease && 182 event->evtype != XI_ButtonRelease &&
179 event->evtype != XI_Motion) 183 event->evtype != XI_Motion)
180 return true; 184 return true;
181 185
182 if (!pointer_device_lookup_[xiev->deviceid]) 186 if (!pointer_device_lookup_[xiev->deviceid])
183 return false; 187 return false;
184 188
185 return IsTouchDevice(xiev->deviceid) ? !touch_events_disabled_ : true; 189 return IsTouchDevice(xiev->deviceid) ? !touch_events_disabled_ : true;
186 } 190 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 if (ptr[0] || ptr[1]) 322 if (ptr[0] || ptr[1])
319 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1])); 323 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1]));
320 } 324 }
321 XFree(prop_return); 325 XFree(prop_return);
322 } 326 }
323 327
324 XCloseDevice(display, device); 328 XCloseDevice(display, device);
325 } 329 }
326 330
327 } // namespace ui 331 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698