OLD | NEW |
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_win.h" | 5 #include "remoting/host/event_executor_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "app/keyboard_codes.h" | 9 #include "app/keyboard_codes.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 NewRunnableMethod(this, &EventExecutorWin::InjectMouseEvent, | 46 NewRunnableMethod(this, &EventExecutorWin::InjectMouseEvent, |
47 event, done)); | 47 event, done)); |
48 return; | 48 return; |
49 } | 49 } |
50 HandleMouse(event); | 50 HandleMouse(event); |
51 done->Run(); | 51 done->Run(); |
52 delete done; | 52 delete done; |
53 } | 53 } |
54 | 54 |
55 void EventExecutorWin::HandleKey(const KeyEvent* event) { | 55 void EventExecutorWin::HandleKey(const KeyEvent* event) { |
56 int key = event->key(); | 56 int key = event->keycode(); |
57 bool down = event->pressed(); | 57 bool down = event->pressed(); |
58 | 58 |
59 // Calculate scan code from virtual key. | 59 // Calculate scan code from virtual key. |
60 HKL hkl = GetKeyboardLayout(0); | 60 HKL hkl = GetKeyboardLayout(0); |
61 int scan_code = MapVirtualKeyEx(key, MAPVK_VK_TO_VSC_EX, hkl); | 61 int scan_code = MapVirtualKeyEx(key, MAPVK_VK_TO_VSC_EX, hkl); |
62 | 62 |
63 INPUT input; | 63 INPUT input; |
64 input.type = INPUT_KEYBOARD; | 64 input.type = INPUT_KEYBOARD; |
65 input.ki.time = 0; | 65 input.ki.time = 0; |
66 input.ki.wVk = key; | 66 input.ki.wVk = key; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } else { | 142 } else { |
143 button_event.mi.dwFlags = | 143 button_event.mi.dwFlags = |
144 down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP; | 144 down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP; |
145 } | 145 } |
146 | 146 |
147 SendInput(1, &button_event, sizeof(INPUT)); | 147 SendInput(1, &button_event, sizeof(INPUT)); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 } // namespace remoting | 151 } // namespace remoting |
OLD | NEW |