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

Side by Side Diff: remoting/client/input_handler.cc

Issue 3341005: Add mouse/keyboard event support to Chromoting client (Pepper and X11). (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: review comments Created 10 years, 3 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
« no previous file with comments | « remoting/client/input_handler.h ('k') | remoting/client/plugin/chromoting_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/client/input_handler.h" 5 #include "remoting/client/input_handler.h"
6 6
7 #include "remoting/client/chromoting_view.h" 7 #include "remoting/client/chromoting_view.h"
8 #include "remoting/client/host_connection.h" 8 #include "remoting/client/host_connection.h"
9 9
10 namespace remoting { 10 namespace remoting {
11 11
12 InputHandler::InputHandler(ClientContext* context, 12 InputHandler::InputHandler(ClientContext* context,
13 HostConnection* connection, 13 HostConnection* connection,
14 ChromotingView* view) 14 ChromotingView* view)
15 : context_(context), 15 : context_(context),
16 connection_(connection), 16 connection_(connection),
17 view_(view), 17 view_(view),
18 send_absolute_mouse_(true), 18 send_absolute_mouse_(true),
19 mouse_x_(0), 19 mouse_x_(0),
20 mouse_y_(0) { 20 mouse_y_(0) {
21 } 21 }
22 22
23 void InputHandler::SendKeyEvent(bool press, int keycode) {
24 ChromotingClientMessage msg;
25
26 KeyEvent *event = msg.mutable_key_event();
27 event->set_key(keycode);
28 event->set_pressed(press);
29
30 connection_->SendEvent(msg);
31 }
32
23 void InputHandler::SendMouseMoveEvent(int x, int y) { 33 void InputHandler::SendMouseMoveEvent(int x, int y) {
24 ChromotingClientMessage msg; 34 ChromotingClientMessage msg;
25 35
26 if (send_absolute_mouse_) { 36 if (send_absolute_mouse_) {
27 MouseSetPositionEvent *event = msg.mutable_mouse_set_position_event(); 37 MouseSetPositionEvent *event = msg.mutable_mouse_set_position_event();
28 event->set_x(x); 38 event->set_x(x);
29 event->set_y(y); 39 event->set_y(y);
30 40
31 int width, height; 41 int width, height;
32 view_->GetScreenSize(&width, &height); 42 view_->GetScreenSize(&width, &height);
(...skipping 27 matching lines...) Expand all
60 if (button_down) { 70 if (button_down) {
61 msg.mutable_mouse_down_event()->set_button(button); 71 msg.mutable_mouse_down_event()->set_button(button);
62 } else { 72 } else {
63 msg.mutable_mouse_up_event()->set_button(button); 73 msg.mutable_mouse_up_event()->set_button(button);
64 } 74 }
65 75
66 connection_->SendEvent(msg); 76 connection_->SendEvent(msg);
67 } 77 }
68 78
69 } // namespace remoting 79 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/input_handler.h ('k') | remoting/client/plugin/chromoting_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698