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/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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 #if defined(USE_XI2_MT) | 171 #if defined(USE_XI2_MT) |
172 if (event->evtype == XI_TouchBegin || | 172 if (event->evtype == XI_TouchBegin || |
173 event->evtype == XI_TouchUpdate || | 173 event->evtype == XI_TouchUpdate || |
174 event->evtype == XI_TouchEnd) { | 174 event->evtype == XI_TouchEnd) { |
175 return !touch_events_disabled_ && IsTouchDevice(xiev->deviceid); | 175 return !touch_events_disabled_ && IsTouchDevice(xiev->deviceid); |
176 } | 176 } |
177 #endif | 177 #endif |
178 // Make sure only key-events from the master device are processed. | 178 // Make sure only key-events from the master device are processed. |
179 if (event->evtype == XI_KeyPress || event->evtype == XI_KeyRelease) | 179 if (event->evtype == XI_KeyPress || event->evtype == XI_KeyRelease) |
180 return xiev->deviceid != xiev->sourceid; | 180 return xiev->deviceid == xiev->sourceid; |
181 | 181 |
182 if (event->evtype != XI_ButtonPress && | 182 if (event->evtype != XI_ButtonPress && |
183 event->evtype != XI_ButtonRelease && | 183 event->evtype != XI_ButtonRelease && |
184 event->evtype != XI_Motion) | 184 event->evtype != XI_Motion) |
185 return true; | 185 return true; |
186 | 186 |
187 if (!pointer_device_lookup_[xiev->deviceid]) | 187 if (!pointer_device_lookup_[xiev->deviceid]) |
188 return false; | 188 return false; |
189 | 189 |
190 return IsTouchDevice(xiev->deviceid) ? !touch_events_disabled_ : true; | 190 return IsTouchDevice(xiev->deviceid) ? !touch_events_disabled_ : true; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 if (ptr[0] || ptr[1]) | 347 if (ptr[0] || ptr[1]) |
348 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1])); | 348 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1])); |
349 } | 349 } |
350 XFree(prop_return); | 350 XFree(prop_return); |
351 } | 351 } |
352 | 352 |
353 XCloseDevice(display, device); | 353 XCloseDevice(display, device); |
354 } | 354 } |
355 | 355 |
356 } // namespace ui | 356 } // namespace ui |
OLD | NEW |