| 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 <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 input.ki.time = 0; | 190 input.ki.time = 0; |
| 191 input.ki.dwFlags = KEYEVENTF_SCANCODE; | 191 input.ki.dwFlags = KEYEVENTF_SCANCODE; |
| 192 if (!event.pressed()) | 192 if (!event.pressed()) |
| 193 input.ki.dwFlags |= KEYEVENTF_KEYUP; | 193 input.ki.dwFlags |= KEYEVENTF_KEYUP; |
| 194 | 194 |
| 195 int scancode = UsbKeycodeToNativeKeycode(event.usb_keycode()); | 195 int scancode = UsbKeycodeToNativeKeycode(event.usb_keycode()); |
| 196 VLOG(3) << "Converting USB keycode: " << std::hex << event.usb_keycode() | 196 VLOG(3) << "Converting USB keycode: " << std::hex << event.usb_keycode() |
| 197 << " to scancode: " << scancode << std::dec; | 197 << " to scancode: " << scancode << std::dec; |
| 198 | 198 |
| 199 // Ignore events which can't be mapped. | 199 // Ignore events which can't be mapped. |
| 200 if (scancode == kInvalidKeycode) | 200 if (scancode == InvalidNativeKeycode()) |
| 201 return; | 201 return; |
| 202 | 202 |
| 203 // Windows scancodes are only 8-bit, so store the low-order byte into the | 203 // Windows scancodes are only 8-bit, so store the low-order byte into the |
| 204 // event and set the extended flag if any high-order bits are set. The only | 204 // event and set the extended flag if any high-order bits are set. The only |
| 205 // high-order values we should see are 0xE0 or 0xE1. The extended bit usually | 205 // high-order values we should see are 0xE0 or 0xE1. The extended bit usually |
| 206 // distinguishes keys with the same meaning, e.g. left & right shift. | 206 // distinguishes keys with the same meaning, e.g. left & right shift. |
| 207 input.ki.wScan = scancode & 0xFF; | 207 input.ki.wScan = scancode & 0xFF; |
| 208 if ((scancode & 0xFF00) != 0x0000) { | 208 if ((scancode & 0xFF00) != 0x0000) { |
| 209 input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY; | 209 input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY; |
| 210 } | 210 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } // namespace | 302 } // namespace |
| 303 | 303 |
| 304 scoped_ptr<EventExecutor> EventExecutor::Create( | 304 scoped_ptr<EventExecutor> EventExecutor::Create( |
| 305 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 305 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 306 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 306 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 307 return scoped_ptr<EventExecutor>( | 307 return scoped_ptr<EventExecutor>( |
| 308 new EventExecutorWin(main_task_runner, ui_task_runner)); | 308 new EventExecutorWin(main_task_runner, ui_task_runner)); |
| 309 } | 309 } |
| 310 | 310 |
| 311 } // namespace remoting | 311 } // namespace remoting |
| OLD | NEW |