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/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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // static | 55 // static |
56 void TouchFactory::SetTouchDeviceListFromCommandLine() { | 56 void TouchFactory::SetTouchDeviceListFromCommandLine() { |
57 // Get a list of pointer-devices that should be treated as touch-devices. | 57 // Get a list of pointer-devices that should be treated as touch-devices. |
58 // This is primarily used for testing/debugging touch-event processing when a | 58 // This is primarily used for testing/debugging touch-event processing when a |
59 // touch-device isn't available. | 59 // touch-device isn't available. |
60 std::string touch_devices = | 60 std::string touch_devices = |
61 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 61 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
62 switches::kTouchDevices); | 62 switches::kTouchDevices); |
63 | 63 |
64 if (!touch_devices.empty()) { | 64 if (!touch_devices.empty()) { |
65 std::vector<std::string> devs; | 65 std::vector<std::string> devs = base::SplitString( |
| 66 touch_devices, ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
66 std::vector<int> device_ids; | 67 std::vector<int> device_ids; |
67 int devid; | 68 int devid; |
68 base::SplitString(touch_devices, ',', &devs); | |
69 for (std::vector<std::string>::iterator iter = devs.begin(); | 69 for (std::vector<std::string>::iterator iter = devs.begin(); |
70 iter != devs.end(); ++iter) { | 70 iter != devs.end(); ++iter) { |
71 if (base::StringToInt(*iter, reinterpret_cast<int*>(&devid))) | 71 if (base::StringToInt(*iter, reinterpret_cast<int*>(&devid))) |
72 device_ids.push_back(devid); | 72 device_ids.push_back(devid); |
73 else | 73 else |
74 DLOG(WARNING) << "Invalid touch-device id: " << *iter; | 74 DLOG(WARNING) << "Invalid touch-device id: " << *iter; |
75 } | 75 } |
76 ui::TouchFactory::GetInstance()->SetTouchDeviceList(device_ids); | 76 ui::TouchFactory::GetInstance()->SetTouchDeviceList(device_ids); |
77 } | 77 } |
78 } | 78 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 std::find_if(touchscreens.begin(), touchscreens.end(), | 313 std::find_if(touchscreens.begin(), touchscreens.end(), |
314 [device_id](const TouchscreenDevice& touchscreen) { | 314 [device_id](const TouchscreenDevice& touchscreen) { |
315 return touchscreen.id == device_id; | 315 return touchscreen.id == device_id; |
316 }); | 316 }); |
317 // Internal displays will have a vid and pid of 0. Ignore them. | 317 // Internal displays will have a vid and pid of 0. Ignore them. |
318 if (it != touchscreens.end() && it->vendor_id && it->product_id) | 318 if (it != touchscreens.end() && it->vendor_id && it->product_id) |
319 touchscreen_ids_.insert(std::make_pair(it->vendor_id, it->product_id)); | 319 touchscreen_ids_.insert(std::make_pair(it->vendor_id, it->product_id)); |
320 } | 320 } |
321 | 321 |
322 } // namespace ui | 322 } // namespace ui |
OLD | NEW |