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

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

Issue 1230353002: Small fix for touch screen on Linux with or without flag --touch-devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« 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/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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 virtual_core_keyboard_device_ = devinfo.deviceid; 121 virtual_core_keyboard_device_ = devinfo.deviceid;
122 } 122 }
123 123
124 if (devinfo.use == XIFloatingSlave || devinfo.use == XISlavePointer) { 124 if (devinfo.use == XIFloatingSlave || devinfo.use == XISlavePointer) {
125 for (int k = 0; k < devinfo.num_classes; ++k) { 125 for (int k = 0; k < devinfo.num_classes; ++k) {
126 XIAnyClassInfo* xiclassinfo = devinfo.classes[k]; 126 XIAnyClassInfo* xiclassinfo = devinfo.classes[k];
127 if (xiclassinfo->type == XITouchClass) { 127 if (xiclassinfo->type == XITouchClass) {
128 XITouchClassInfo* tci = 128 XITouchClassInfo* tci =
129 reinterpret_cast<XITouchClassInfo*>(xiclassinfo); 129 reinterpret_cast<XITouchClassInfo*>(xiclassinfo);
130 // Only care direct touch device (such as touch screen) right now 130 // Only care direct touch device (such as touch screen) right now
131 if (tci->mode == XIDirectTouch) 131 if (tci->mode == XIDirectTouch) {
132 CacheTouchscreenIds(devinfo.deviceid); 132 CacheTouchscreenIds(devinfo.deviceid);
133 if (devinfo.use == XISlavePointer) { 133 if (devinfo.use == XISlavePointer) {
134 device_master_id_list_[devinfo.deviceid] = devinfo.attachment; 134 device_master_id_list_[devinfo.deviceid] = devinfo.attachment;
135 // If the slave device is direct touch device, we also set its 135 // If the slave device is direct touch device, we also set its
136 // master device to be touch device. 136 // master device to be touch device.
137 touch_device_lookup_[devinfo.attachment] = true; 137 touch_device_lookup_[devinfo.attachment] = true;
138 touch_device_list_[devinfo.attachment] = true; 138 touch_device_list_[devinfo.attachment] = true;
139 } 139 }
140 }
140 } 141 }
141 } 142 }
142 } 143 }
143 } 144 }
144 } 145 }
145 146
146 bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) { 147 bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) {
147 DCHECK_EQ(GenericEvent, xev->type); 148 DCHECK_EQ(GenericEvent, xev->type);
148 XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data); 149 XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data);
149 XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event); 150 XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 std::find_if(touchscreens.begin(), touchscreens.end(), 314 std::find_if(touchscreens.begin(), touchscreens.end(),
314 [device_id](const TouchscreenDevice& touchscreen) { 315 [device_id](const TouchscreenDevice& touchscreen) {
315 return touchscreen.id == device_id; 316 return touchscreen.id == device_id;
316 }); 317 });
317 // Internal displays will have a vid and pid of 0. Ignore them. 318 // Internal displays will have a vid and pid of 0. Ignore them.
318 if (it != touchscreens.end() && it->vendor_id && it->product_id) 319 if (it != touchscreens.end() && it->vendor_id && it->product_id)
319 touchscreen_ids_.insert(std::make_pair(it->vendor_id, it->product_id)); 320 touchscreen_ids_.insert(std::make_pair(it->vendor_id, it->product_id));
320 } 321 }
321 322
322 } // namespace ui 323 } // 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