| 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/input_injector.h" | 5 #include "remoting/host/input_injector.h" |
| 6 | 6 |
| 7 #include <X11/extensions/XInput.h> | 7 #include <X11/extensions/XInput.h> |
| 8 #include <X11/extensions/XTest.h> | 8 #include <X11/extensions/XTest.h> |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 // Pixel-to-wheel-ticks conversion ratio used by GTK. | 86 // Pixel-to-wheel-ticks conversion ratio used by GTK. |
| 87 // From third_party/WebKit/Source/web/gtk/WebInputEventFactory.cpp . | 87 // From third_party/WebKit/Source/web/gtk/WebInputEventFactory.cpp . |
| 88 const float kWheelTicksPerPixel = 3.0f / 160.0f; | 88 const float kWheelTicksPerPixel = 3.0f / 160.0f; |
| 89 | 89 |
| 90 // A class to generate events on Linux. | 90 // A class to generate events on Linux. |
| 91 class InputInjectorLinux : public InputInjector { | 91 class InputInjectorLinux : public InputInjector { |
| 92 public: | 92 public: |
| 93 explicit InputInjectorLinux( | 93 explicit InputInjectorLinux( |
| 94 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 94 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 95 virtual ~InputInjectorLinux(); | 95 ~InputInjectorLinux() override; |
| 96 | 96 |
| 97 bool Init(); | 97 bool Init(); |
| 98 | 98 |
| 99 // Clipboard stub interface. | 99 // Clipboard stub interface. |
| 100 virtual void InjectClipboardEvent(const ClipboardEvent& event) override; | 100 void InjectClipboardEvent(const ClipboardEvent& event) override; |
| 101 | 101 |
| 102 // InputStub interface. | 102 // InputStub interface. |
| 103 virtual void InjectKeyEvent(const KeyEvent& event) override; | 103 void InjectKeyEvent(const KeyEvent& event) override; |
| 104 virtual void InjectTextEvent(const TextEvent& event) override; | 104 void InjectTextEvent(const TextEvent& event) override; |
| 105 virtual void InjectMouseEvent(const MouseEvent& event) override; | 105 void InjectMouseEvent(const MouseEvent& event) override; |
| 106 | 106 |
| 107 // InputInjector interface. | 107 // InputInjector interface. |
| 108 virtual void Start( | 108 void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override; |
| 109 scoped_ptr<protocol::ClipboardStub> client_clipboard) override; | |
| 110 | 109 |
| 111 private: | 110 private: |
| 112 // The actual implementation resides in InputInjectorLinux::Core class. | 111 // The actual implementation resides in InputInjectorLinux::Core class. |
| 113 class Core : public base::RefCountedThreadSafe<Core> { | 112 class Core : public base::RefCountedThreadSafe<Core> { |
| 114 public: | 113 public: |
| 115 explicit Core(scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 114 explicit Core(scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 116 | 115 |
| 117 bool Init(); | 116 bool Init(); |
| 118 | 117 |
| 119 // Mirrors the ClipboardStub interface. | 118 // Mirrors the ClipboardStub interface. |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 604 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 606 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 605 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 607 scoped_ptr<InputInjectorLinux> injector( | 606 scoped_ptr<InputInjectorLinux> injector( |
| 608 new InputInjectorLinux(main_task_runner)); | 607 new InputInjectorLinux(main_task_runner)); |
| 609 if (!injector->Init()) | 608 if (!injector->Init()) |
| 610 return nullptr; | 609 return nullptr; |
| 611 return injector.Pass(); | 610 return injector.Pass(); |
| 612 } | 611 } |
| 613 | 612 |
| 614 } // namespace remoting | 613 } // namespace remoting |
| OLD | NEW |