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

Side by Side Diff: ui/events/platform/x11/x11_hotplug_event_handler.cc

Issue 904733002: Remove useless InputDevice::name field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « ui/events/ozone/evdev/input_device_factory_evdev.cc ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/platform/x11/x11_hotplug_event_handler.h" 5 #include "ui/events/platform/x11/x11_hotplug_event_handler.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/extensions/XInput.h> 8 #include <X11/extensions/XInput.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 10
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 for (const DeviceInfo& device_info : device_infos) { 218 for (const DeviceInfo& device_info : device_infos) {
219 if (!device_info.enabled || device_info.use != XISlaveKeyboard) 219 if (!device_info.enabled || device_info.use != XISlaveKeyboard)
220 continue; // Assume all keyboards are keyboard slaves 220 continue; // Assume all keyboards are keyboard slaves
221 std::string device_name(device_info.name); 221 std::string device_name(device_info.name);
222 base::TrimWhitespaceASCII(device_name, base::TRIM_TRAILING, &device_name); 222 base::TrimWhitespaceASCII(device_name, base::TRIM_TRAILING, &device_name);
223 if (IsTestKeyboard(device_name)) 223 if (IsTestKeyboard(device_name))
224 continue; // Skip test devices. 224 continue; // Skip test devices.
225 if (IsKnownInvalidKeyboardDevice(device_name)) 225 if (IsKnownInvalidKeyboardDevice(device_name))
226 continue; // Skip invalid devices. 226 continue; // Skip invalid devices.
227 InputDeviceType type = GetInputDeviceTypeFromPath(device_info.path); 227 InputDeviceType type = GetInputDeviceTypeFromPath(device_info.path);
228 devices.push_back( 228 devices.push_back(KeyboardDevice(device_info.id, type));
229 KeyboardDevice(device_info.id, type, device_name));
230 } 229 }
231 230
232 reply_runner->PostTask(FROM_HERE, base::Bind(callback, devices)); 231 reply_runner->PostTask(FROM_HERE, base::Bind(callback, devices));
233 } 232 }
234 233
235 // Helper used to parse touchscreen information. When it is done it uses 234 // Helper used to parse touchscreen information. When it is done it uses
236 // |reply_runner| and |callback| to update the state on the UI thread. 235 // |reply_runner| and |callback| to update the state on the UI thread.
237 void HandleTouchscreenDevicesInWorker( 236 void HandleTouchscreenDevicesInWorker(
238 const std::vector<DeviceInfo>& device_infos, 237 const std::vector<DeviceInfo>& device_infos,
239 const DisplayState& display_state, 238 const DisplayState& display_state,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 270
272 if (device_info.touch_class_info.mode) 271 if (device_info.touch_class_info.mode)
273 is_direct_touch = device_info.touch_class_info.mode == XIDirectTouch; 272 is_direct_touch = device_info.touch_class_info.mode == XIDirectTouch;
274 273
275 // Touchscreens should have absolute X and Y axes, and be direct touch 274 // Touchscreens should have absolute X and Y axes, and be direct touch
276 // devices. 275 // devices.
277 if (max_x > 0.0 && max_y > 0.0 && is_direct_touch) { 276 if (max_x > 0.0 && max_y > 0.0 && is_direct_touch) {
278 InputDeviceType type = GetInputDeviceTypeFromPath(device_info.path); 277 InputDeviceType type = GetInputDeviceTypeFromPath(device_info.path);
279 // |max_x| and |max_y| are inclusive values, so we need to add 1 to get 278 // |max_x| and |max_y| are inclusive values, so we need to add 1 to get
280 // the size. 279 // the size.
281 devices.push_back( 280 devices.push_back(TouchscreenDevice(
282 TouchscreenDevice(device_info.id, type, device_info.name, 281 device_info.id, type, gfx::Size(max_x + 1, max_y + 1),
283 gfx::Size(max_x + 1, max_y + 1), 282 device_info.touch_class_info.num_touches));
284 device_info.touch_class_info.num_touches));
285 } 283 }
286 } 284 }
287 285
288 reply_runner->PostTask(FROM_HERE, base::Bind(callback, devices)); 286 reply_runner->PostTask(FROM_HERE, base::Bind(callback, devices));
289 } 287 }
290 288
291 // Called on a worker thread to parse the device information. 289 // Called on a worker thread to parse the device information.
292 void HandleHotplugEventInWorker( 290 void HandleHotplugEventInWorker(
293 const std::vector<DeviceInfo>& devices, 291 const std::vector<DeviceInfo>& devices,
294 const DisplayState& display_state, 292 const DisplayState& display_state,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 base::WorkerPool::PostTask(FROM_HERE, 347 base::WorkerPool::PostTask(FROM_HERE,
350 base::Bind(&HandleHotplugEventInWorker, 348 base::Bind(&HandleHotplugEventInWorker,
351 device_infos, 349 device_infos,
352 display_state, 350 display_state,
353 base::ThreadTaskRunnerHandle::Get(), 351 base::ThreadTaskRunnerHandle::Get(),
354 callbacks), 352 callbacks),
355 true /* task_is_slow */); 353 true /* task_is_slow */);
356 } 354 }
357 355
358 } // namespace ui 356 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/input_device_factory_evdev.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698