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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 void InputInjectorX11::InjectMouseEvent(const MouseEvent& event) { | 231 void InputInjectorX11::InjectMouseEvent(const MouseEvent& event) { |
232 core_->InjectMouseEvent(event); | 232 core_->InjectMouseEvent(event); |
233 } | 233 } |
234 | 234 |
235 void InputInjectorX11::InjectTouchEvent(const TouchEvent& event) { | 235 void InputInjectorX11::InjectTouchEvent(const TouchEvent& event) { |
236 NOTIMPLEMENTED() << "Raw touch event injection not implemented for X11."; | 236 NOTIMPLEMENTED() << "Raw touch event injection not implemented for X11."; |
237 } | 237 } |
238 | 238 |
239 void InputInjectorX11::Start( | 239 void InputInjectorX11::Start( |
240 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 240 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
241 core_->Start(client_clipboard.Pass()); | 241 core_->Start(std::move(client_clipboard)); |
242 } | 242 } |
243 | 243 |
244 InputInjectorX11::Core::Core( | 244 InputInjectorX11::Core::Core( |
245 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 245 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
246 : task_runner_(task_runner), | 246 : task_runner_(task_runner), |
247 latest_mouse_position_(-1, -1), | 247 latest_mouse_position_(-1, -1), |
248 wheel_ticks_x_(0.0f), | 248 wheel_ticks_x_(0.0f), |
249 wheel_ticks_y_(0.0f), | 249 wheel_ticks_y_(0.0f), |
250 display_(XOpenDisplay(nullptr)), | 250 display_(XOpenDisplay(nullptr)), |
251 root_window_(BadValue), | 251 root_window_(BadValue), |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 618 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
619 if (!task_runner_->BelongsToCurrentThread()) { | 619 if (!task_runner_->BelongsToCurrentThread()) { |
620 task_runner_->PostTask( | 620 task_runner_->PostTask( |
621 FROM_HERE, | 621 FROM_HERE, |
622 base::Bind(&Core::Start, this, base::Passed(&client_clipboard))); | 622 base::Bind(&Core::Start, this, base::Passed(&client_clipboard))); |
623 return; | 623 return; |
624 } | 624 } |
625 | 625 |
626 InitMouseButtonMap(); | 626 InitMouseButtonMap(); |
627 | 627 |
628 clipboard_->Start(client_clipboard.Pass()); | 628 clipboard_->Start(std::move(client_clipboard)); |
629 } | 629 } |
630 | 630 |
631 void InputInjectorX11::Core::Stop() { | 631 void InputInjectorX11::Core::Stop() { |
632 if (!task_runner_->BelongsToCurrentThread()) { | 632 if (!task_runner_->BelongsToCurrentThread()) { |
633 task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); | 633 task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Stop, this)); |
634 return; | 634 return; |
635 } | 635 } |
636 | 636 |
637 clipboard_.reset(); | 637 clipboard_.reset(); |
638 } | 638 } |
639 | 639 |
640 } // namespace | 640 } // namespace |
641 | 641 |
642 // static | 642 // static |
643 scoped_ptr<InputInjector> InputInjector::Create( | 643 scoped_ptr<InputInjector> InputInjector::Create( |
644 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 644 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
645 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 645 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
646 scoped_ptr<InputInjectorX11> injector( | 646 scoped_ptr<InputInjectorX11> injector( |
647 new InputInjectorX11(main_task_runner)); | 647 new InputInjectorX11(main_task_runner)); |
648 if (!injector->Init()) | 648 if (!injector->Init()) |
649 return nullptr; | 649 return nullptr; |
650 return injector.Pass(); | 650 return std::move(injector); |
651 } | 651 } |
652 | 652 |
653 // static | 653 // static |
654 bool InputInjector::SupportsTouchEvents() { | 654 bool InputInjector::SupportsTouchEvents() { |
655 return false; | 655 return false; |
656 } | 656 } |
657 | 657 |
658 } // namespace remoting | 658 } // namespace remoting |
OLD | NEW |