| 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 "remoting/host/event_executor.h" | 5 #include "remoting/host/event_executor.h" |
| 6 | 6 |
| 7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 #include <X11/extensions/XTest.h> | 8 #include <X11/extensions/XTest.h> |
| 9 #include <X11/extensions/XInput.h> | 9 #include <X11/extensions/XInput.h> |
| 10 | 10 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 XDeviceInfo* device_info = &devices[i]; | 295 XDeviceInfo* device_info = &devices[i]; |
| 296 if (device_info->use == IsXExtensionPointer && | 296 if (device_info->use == IsXExtensionPointer && |
| 297 strcmp(device_info->name, "Virtual core XTEST pointer") == 0) { | 297 strcmp(device_info->name, "Virtual core XTEST pointer") == 0) { |
| 298 device_id = device_info->id; | 298 device_id = device_info->id; |
| 299 device_found = true; | 299 device_found = true; |
| 300 break; | 300 break; |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 XFreeDeviceList(devices); | 303 XFreeDeviceList(devices); |
| 304 | 304 |
| 305 if (!device_found) | 305 if (!device_found) { |
| 306 LOG(ERROR) << "Cannot find XTest device."; | 306 LOG(INFO) << "Cannot find XTest device."; |
| 307 return; |
| 308 } |
| 307 | 309 |
| 308 XDevice* device = XOpenDevice(display_, device_id); | 310 XDevice* device = XOpenDevice(display_, device_id); |
| 309 if (!device) | 311 if (!device) { |
| 310 LOG(ERROR) << "Cannot open XTest device."; | 312 LOG(ERROR) << "Cannot open XTest device."; |
| 313 return; |
| 314 } |
| 311 | 315 |
| 312 int num_device_buttons = XGetDeviceButtonMapping(display_, device, NULL, 0); | 316 int num_device_buttons = XGetDeviceButtonMapping(display_, device, NULL, 0); |
| 313 scoped_array<unsigned char> button_mapping(new unsigned char[num_buttons]); | 317 scoped_array<unsigned char> button_mapping(new unsigned char[num_buttons]); |
| 314 for (int i = 0; i < num_device_buttons; i++) { | 318 for (int i = 0; i < num_device_buttons; i++) { |
| 315 button_mapping[i] = i + 1; | 319 button_mapping[i] = i + 1; |
| 316 } | 320 } |
| 317 error = XSetDeviceButtonMapping(display_, device, button_mapping.get(), | 321 error = XSetDeviceButtonMapping(display_, device, button_mapping.get(), |
| 318 num_device_buttons); | 322 num_device_buttons); |
| 319 if (error != Success) | 323 if (error != Success) |
| 320 LOG(ERROR) << "Failed to set XTest device button mapping: " << error; | 324 LOG(ERROR) << "Failed to set XTest device button mapping: " << error; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 379 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 376 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 380 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 377 scoped_ptr<EventExecutorLinux> executor( | 381 scoped_ptr<EventExecutorLinux> executor( |
| 378 new EventExecutorLinux(main_task_runner)); | 382 new EventExecutorLinux(main_task_runner)); |
| 379 if (!executor->Init()) | 383 if (!executor->Init()) |
| 380 return scoped_ptr<EventExecutor>(NULL); | 384 return scoped_ptr<EventExecutor>(NULL); |
| 381 return executor.PassAs<EventExecutor>(); | 385 return executor.PassAs<EventExecutor>(); |
| 382 } | 386 } |
| 383 | 387 |
| 384 } // namespace remoting | 388 } // namespace remoting |
| OLD | NEW |