| OLD | NEW |
| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 333 } |
| 334 | 334 |
| 335 // X11 is not thread safe, so first get all the required state. | 335 // X11 is not thread safe, so first get all the required state. |
| 336 DisplayState display_state; | 336 DisplayState display_state; |
| 337 display_state.mt_position_x = atom_cache_.GetAtom("Abs MT Position X"); | 337 display_state.mt_position_x = atom_cache_.GetAtom("Abs MT Position X"); |
| 338 display_state.mt_position_y = atom_cache_.GetAtom("Abs MT Position Y"); | 338 display_state.mt_position_y = atom_cache_.GetAtom("Abs MT Position Y"); |
| 339 | 339 |
| 340 UiCallbacks callbacks; | 340 UiCallbacks callbacks; |
| 341 callbacks.keyboard_callback = base::Bind(&OnKeyboardDevices); | 341 callbacks.keyboard_callback = base::Bind(&OnKeyboardDevices); |
| 342 callbacks.touchscreen_callback = base::Bind(&OnTouchscreenDevices); | 342 callbacks.touchscreen_callback = base::Bind(&OnTouchscreenDevices); |
| 343 // TODO(pkotwicz): Compute the lists of mice and touchpads and send the new |
| 344 // lists to DeviceHotplugEventObserver. |
| 343 | 345 |
| 344 // Parsing the device information may block, so delegate the operation to a | 346 // Parsing the device information may block, so delegate the operation to a |
| 345 // worker thread. Once the device information is extracted the parsed devices | 347 // worker thread. Once the device information is extracted the parsed devices |
| 346 // will be returned via the callbacks. | 348 // will be returned via the callbacks. |
| 347 base::WorkerPool::PostTask(FROM_HERE, | 349 base::WorkerPool::PostTask(FROM_HERE, |
| 348 base::Bind(&HandleHotplugEventInWorker, | 350 base::Bind(&HandleHotplugEventInWorker, |
| 349 device_infos, | 351 device_infos, |
| 350 display_state, | 352 display_state, |
| 351 base::ThreadTaskRunnerHandle::Get(), | 353 base::ThreadTaskRunnerHandle::Get(), |
| 352 callbacks), | 354 callbacks), |
| 353 true /* task_is_slow */); | 355 true /* task_is_slow */); |
| 354 } | 356 } |
| 355 | 357 |
| 356 } // namespace ui | 358 } // namespace ui |
| OLD | NEW |