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

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

Issue 5559011: Remove ChromotingClientMessage (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 10 years 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) 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/host/event_executor_linux.h" 5 #include "remoting/host/event_executor_linux.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #include <X11/keysym.h> 8 #include <X11/keysym.h>
9 #include <X11/extensions/XTest.h> 9 #include <X11/extensions/XTest.h>
10 10
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 286
287 width_ = root_attr.width; 287 width_ = root_attr.width;
288 height_ = root_attr.height; 288 height_ = root_attr.height;
289 289
290 return true; 290 return true;
291 } 291 }
292 292
293 void EventExecutorLinuxPimpl::HandleKey(const KeyEvent* key_event) { 293 void EventExecutorLinuxPimpl::HandleKey(const KeyEvent* key_event) {
294 // TODO(ajwong): This will only work for QWERTY keyboards. 294 // TODO(ajwong): This will only work for QWERTY keyboards.
295 int keysym = ChromotocolKeycodeToX11Keysym(key_event->key()); 295 int keysym = ChromotocolKeycodeToX11Keysym(key_event->keycode());
296 296
297 if (keysym == -1) { 297 if (keysym == -1) {
298 LOG(WARNING) << "Ignoring unknown key: " << key_event->key(); 298 LOG(WARNING) << "Ignoring unknown key: " << key_event->keycode();
299 return; 299 return;
300 } 300 }
301 301
302 // Translate the keysym into a keycode understandable by the X display. 302 // Translate the keysym into a keycode understandable by the X display.
303 int keycode = XKeysymToKeycode(display_, keysym); 303 int keycode = XKeysymToKeycode(display_, keysym);
304 if (keycode == 0) { 304 if (keycode == 0) {
305 LOG(WARNING) << "Ignoring undefined keysym: " << keysym 305 LOG(WARNING) << "Ignoring undefined keysym: " << keysym
306 << " for key: " << key_event->key(); 306 << " for key: " << key_event->keycode();
307 return; 307 return;
308 } 308 }
309 309
310 VLOG(3) << "Got pepper key: " << key_event->key() 310 VLOG(3) << "Got pepper key: " << key_event->keycode()
311 << " sending keysym: " << keysym 311 << " sending keysym: " << keysym
312 << " to keycode: " << keycode; 312 << " to keycode: " << keycode;
313 XTestFakeKeyEvent(display_, keycode, key_event->pressed(), CurrentTime); 313 XTestFakeKeyEvent(display_, keycode, key_event->pressed(), CurrentTime);
314 } 314 }
315 315
316 void EventExecutorLinuxPimpl::HandleMouse(const MouseEvent* event) { 316 void EventExecutorLinuxPimpl::HandleMouse(const MouseEvent* event) {
317 if (event->has_x() && event->has_y()) { 317 if (event->has_x() && event->has_y()) {
318 if (event->x() < 0 || event->y() < 0 || 318 if (event->x() < 0 || event->y() < 0 ||
319 event->x() > width_ || event->y() > height_) { 319 event->x() > width_ || event->y() > height_) {
320 // A misbehaving client may send these. Drop events that are out of range. 320 // A misbehaving client may send these. Drop events that are out of range.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 done->Run(); 404 done->Run();
405 delete done; 405 delete done;
406 } 406 }
407 407
408 protocol::InputStub* CreateEventExecutor(MessageLoop* message_loop, 408 protocol::InputStub* CreateEventExecutor(MessageLoop* message_loop,
409 Capturer* capturer) { 409 Capturer* capturer) {
410 return new EventExecutorLinux(message_loop, capturer); 410 return new EventExecutorLinux(message_loop, capturer);
411 } 411 }
412 412
413 } // namespace remoting 413 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698