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

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

Issue 12320014: Switch Pepper Linux to use shared USB<->native key conversion table. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix missed kInvalidKeycode. Created 7 years, 10 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
« no previous file with comments | « remoting/host/desktop_session_agent.cc ('k') | remoting/host/event_executor_mac.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) 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 <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #include <X11/extensions/XTest.h> 8 #include <X11/extensions/XTest.h>
9 #include <X11/extensions/XInput.h> 9 #include <X11/extensions/XInput.h>
10 10
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 task_runner_->PostTask(FROM_HERE, 208 task_runner_->PostTask(FROM_HERE,
209 base::Bind(&Core::InjectKeyEvent, this, event)); 209 base::Bind(&Core::InjectKeyEvent, this, event));
210 return; 210 return;
211 } 211 }
212 212
213 int keycode = UsbKeycodeToNativeKeycode(event.usb_keycode()); 213 int keycode = UsbKeycodeToNativeKeycode(event.usb_keycode());
214 VLOG(3) << "Converting USB keycode: " << std::hex << event.usb_keycode() 214 VLOG(3) << "Converting USB keycode: " << std::hex << event.usb_keycode()
215 << " to keycode: " << keycode << std::dec; 215 << " to keycode: " << keycode << std::dec;
216 216
217 // Ignore events which can't be mapped. 217 // Ignore events which can't be mapped.
218 if (keycode == kInvalidKeycode) 218 if (keycode == InvalidNativeKeycode())
219 return; 219 return;
220 220
221 if (event.pressed()) { 221 if (event.pressed()) {
222 if (pressed_keys_.find(keycode) != pressed_keys_.end()) { 222 if (pressed_keys_.find(keycode) != pressed_keys_.end()) {
223 // Key is already held down, so lift the key up to ensure this repeated 223 // Key is already held down, so lift the key up to ensure this repeated
224 // press takes effect. 224 // press takes effect.
225 XTestFakeKeyEvent(display_, keycode, False, CurrentTime); 225 XTestFakeKeyEvent(display_, keycode, False, CurrentTime);
226 } else { 226 } else {
227 // Key is not currently held down, so disable auto-repeat for this 227 // Key is not currently held down, so disable auto-repeat for this
228 // key to avoid repeated presses in case network congestion delays the 228 // key to avoid repeated presses in case network congestion delays the
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 476 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
477 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 477 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
478 scoped_ptr<EventExecutorLinux> executor( 478 scoped_ptr<EventExecutorLinux> executor(
479 new EventExecutorLinux(main_task_runner)); 479 new EventExecutorLinux(main_task_runner));
480 if (!executor->Init()) 480 if (!executor->Init())
481 return scoped_ptr<EventExecutor>(NULL); 481 return scoped_ptr<EventExecutor>(NULL);
482 return executor.PassAs<EventExecutor>(); 482 return executor.PassAs<EventExecutor>();
483 } 483 }
484 484
485 } // namespace remoting 485 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_session_agent.cc ('k') | remoting/host/event_executor_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698