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 <set> | 7 #include <set> |
8 | 8 |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/XF86keysym.h> | 10 #include <X11/XF86keysym.h> |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // Clipboard stub interface. | 42 // Clipboard stub interface. |
43 virtual void InjectClipboardEvent(const ClipboardEvent& event) | 43 virtual void InjectClipboardEvent(const ClipboardEvent& event) |
44 OVERRIDE; | 44 OVERRIDE; |
45 | 45 |
46 // InputStub interface. | 46 // InputStub interface. |
47 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; | 47 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; |
48 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; | 48 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; |
49 | 49 |
50 // EventExecutor interface. | 50 // EventExecutor interface. |
51 virtual void OnSessionStarted() OVERRIDE; | 51 virtual void OnSessionStarted( |
| 52 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; |
52 virtual void OnSessionFinished() OVERRIDE; | 53 virtual void OnSessionFinished() OVERRIDE; |
53 | 54 |
54 private: | 55 private: |
55 // |mode| is one of the AutoRepeatModeOn, AutoRepeatModeOff, | 56 // |mode| is one of the AutoRepeatModeOn, AutoRepeatModeOff, |
56 // AutoRepeatModeDefault constants defined by the XChangeKeyboardControl() | 57 // AutoRepeatModeDefault constants defined by the XChangeKeyboardControl() |
57 // API. | 58 // API. |
58 void SetAutoRepeatForKey(int keycode, int mode); | 59 void SetAutoRepeatForKey(int keycode, int mode); |
59 void InjectScrollWheelClicks(int button, int count); | 60 void InjectScrollWheelClicks(int button, int count); |
60 | 61 |
61 MessageLoop* message_loop_; | 62 MessageLoop* message_loop_; |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 413 } |
413 if (event.has_wheel_offset_x() && event.wheel_offset_x() != 0) { | 414 if (event.has_wheel_offset_x() && event.wheel_offset_x() != 0) { |
414 int dx = event.wheel_offset_x(); | 415 int dx = event.wheel_offset_x(); |
415 InjectScrollWheelClicks(HorizontalScrollWheelToX11ButtonNumber(dx), | 416 InjectScrollWheelClicks(HorizontalScrollWheelToX11ButtonNumber(dx), |
416 abs(dx)); | 417 abs(dx)); |
417 } | 418 } |
418 | 419 |
419 XFlush(display_); | 420 XFlush(display_); |
420 } | 421 } |
421 | 422 |
422 void EventExecutorLinux::OnSessionStarted() { | 423 void EventExecutorLinux::OnSessionStarted( |
| 424 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
423 return; | 425 return; |
424 } | 426 } |
425 | 427 |
426 void EventExecutorLinux::OnSessionFinished() { | 428 void EventExecutorLinux::OnSessionFinished() { |
427 return; | 429 return; |
428 } | 430 } |
429 | 431 |
430 } // namespace | 432 } // namespace |
431 | 433 |
432 scoped_ptr<EventExecutor> EventExecutor::Create(MessageLoop* message_loop, | 434 scoped_ptr<EventExecutor> EventExecutor::Create(MessageLoop* message_loop, |
433 base::MessageLoopProxy* ui_loop, | 435 base::MessageLoopProxy* ui_loop, |
434 Capturer* capturer) { | 436 Capturer* capturer) { |
435 scoped_ptr<EventExecutorLinux> executor( | 437 scoped_ptr<EventExecutorLinux> executor( |
436 new EventExecutorLinux(message_loop)); | 438 new EventExecutorLinux(message_loop)); |
437 if (!executor->Init()) | 439 if (!executor->Init()) |
438 return scoped_ptr<EventExecutor>(NULL); | 440 return scoped_ptr<EventExecutor>(NULL); |
439 return executor.PassAs<EventExecutor>(); | 441 return executor.PassAs<EventExecutor>(); |
440 } | 442 } |
441 | 443 |
442 } // namespace remoting | 444 } // namespace remoting |
OLD | NEW |