Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: remoting/host/event_executor_linux.cc

Issue 9646013: Add the plumbing that will carry a clipboard item from a chromoting client to a host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync, and make InputStub inherit from ClipboardStub. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
11 #include <X11/keysym.h> 11 #include <X11/keysym.h>
12 #include <X11/extensions/XTest.h> 12 #include <X11/extensions/XTest.h>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/message_loop.h" 18 #include "base/message_loop.h"
19 #include "remoting/proto/internal.pb.h" 19 #include "remoting/proto/internal.pb.h"
20 20
21 namespace remoting { 21 namespace remoting {
22 22
23 using protocol::KeyEvent;
23 using protocol::MouseEvent; 24 using protocol::MouseEvent;
24 using protocol::KeyEvent;
25 25
26 namespace { 26 namespace {
27 27
28 // USB to XKB keycode map table. 28 // USB to XKB keycode map table.
29 #define USB_KEYMAP(usb, xkb, win, mac) {usb, xkb} 29 #define USB_KEYMAP(usb, xkb, win, mac) {usb, xkb}
30 #include "remoting/host/usb_keycode_map.h" 30 #include "remoting/host/usb_keycode_map.h"
31 31
32 // A class to generate events on Linux. 32 // A class to generate events on Linux.
33 class EventExecutorLinux : public EventExecutor { 33 class EventExecutorLinux : public EventExecutor {
34 public: 34 public:
35 EventExecutorLinux(MessageLoop* message_loop, Capturer* capturer); 35 EventExecutorLinux(MessageLoop* message_loop, Capturer* capturer);
36 virtual ~EventExecutorLinux(); 36 virtual ~EventExecutorLinux();
37 37
38 bool Init(); 38 bool Init();
39 39
40 // Clipboard stub interface.
41 virtual void InjectClipboardEvent(const protocol::ClipboardEvent& event)
Wez 2012/03/15 01:14:44 nit: Be consist about protocol::ClipboardEvent vs
simonmorris 2012/03/15 16:53:19 I was consistent originally, but another reviewer
42 OVERRIDE;
43
44 // InputStub interface.
40 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; 45 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE;
41 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; 46 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE;
42 47
43 private: 48 private:
44 // |mode| is one of the AutoRepeatModeOn, AutoRepeatModeOff, 49 // |mode| is one of the AutoRepeatModeOn, AutoRepeatModeOff,
45 // AutoRepeatModeDefault constants defined by the XChangeKeyboardControl() 50 // AutoRepeatModeDefault constants defined by the XChangeKeyboardControl()
46 // API. 51 // API.
47 void SetAutoRepeatForKey(int keycode, int mode); 52 void SetAutoRepeatForKey(int keycode, int mode);
48 void InjectScrollWheelClicks(int button, int count); 53 void InjectScrollWheelClicks(int button, int count);
49 54
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 if (!XGetWindowAttributes(display_, root_window_, &root_attr)) { 312 if (!XGetWindowAttributes(display_, root_window_, &root_attr)) {
308 LOG(ERROR) << "Unable to get window attributes"; 313 LOG(ERROR) << "Unable to get window attributes";
309 return false; 314 return false;
310 } 315 }
311 316
312 width_ = root_attr.width; 317 width_ = root_attr.width;
313 height_ = root_attr.height; 318 height_ = root_attr.height;
314 return true; 319 return true;
315 } 320 }
316 321
322 void EventExecutorLinux::InjectClipboardEvent(
323 const protocol::ClipboardEvent& event) {
324 // TODO(simonmorris): Implement clipboard injection.
325 }
326
317 void EventExecutorLinux::InjectKeyEvent(const KeyEvent& event) { 327 void EventExecutorLinux::InjectKeyEvent(const KeyEvent& event) {
318 if (MessageLoop::current() != message_loop_) { 328 if (MessageLoop::current() != message_loop_) {
319 message_loop_->PostTask( 329 message_loop_->PostTask(
320 FROM_HERE, 330 FROM_HERE,
321 base::Bind(&EventExecutorLinux::InjectKeyEvent, base::Unretained(this), 331 base::Bind(&EventExecutorLinux::InjectKeyEvent, base::Unretained(this),
322 event)); 332 event));
323 return; 333 return;
324 } 334 }
325 335
326 int keycode = 0; 336 int keycode = 0;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 Capturer* capturer) { 467 Capturer* capturer) {
458 scoped_ptr<EventExecutorLinux> executor( 468 scoped_ptr<EventExecutorLinux> executor(
459 new EventExecutorLinux(message_loop, capturer)); 469 new EventExecutorLinux(message_loop, capturer));
460 if (!executor->Init()) { 470 if (!executor->Init()) {
461 executor.reset(NULL); 471 executor.reset(NULL);
462 } 472 }
463 return executor.PassAs<protocol::InputStub>(); 473 return executor.PassAs<protocol::InputStub>();
464 } 474 }
465 475
466 } // namespace remoting 476 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698