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/client/plugin/pepper_input_handler.h" | 5 #include "remoting/client/plugin/pepper_input_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/c/dev/ppb_keyboard_input_event_dev.h" | 8 #include "ppapi/c/dev/ppb_keyboard_input_event_dev.h" |
9 #include "ppapi/cpp/input_event.h" | 9 #include "ppapi/cpp/input_event.h" |
10 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 case PP_INPUTEVENT_TYPE_CONTEXTMENU: { | 37 case PP_INPUTEVENT_TYPE_CONTEXTMENU: { |
38 // We need to return true here or else we'll get a local (plugin) context | 38 // We need to return true here or else we'll get a local (plugin) context |
39 // menu instead of the mouseup event for the right click. | 39 // menu instead of the mouseup event for the right click. |
40 return true; | 40 return true; |
41 } | 41 } |
42 | 42 |
43 case PP_INPUTEVENT_TYPE_KEYDOWN: | 43 case PP_INPUTEVENT_TYPE_KEYDOWN: |
44 case PP_INPUTEVENT_TYPE_KEYUP: { | 44 case PP_INPUTEVENT_TYPE_KEYUP: { |
45 pp::KeyboardInputEvent pp_key_event(event); | 45 pp::KeyboardInputEvent pp_key_event(event); |
46 protocol::KeyEvent key_event; | 46 protocol::KeyEvent key_event; |
47 key_event.set_keycode(pp_key_event.GetKeyCode()); | 47 key_event.set_usb_keycode(GetUsbKeyCode(pp_key_event)); |
48 uint32 keycode = GetUsbKeyCode(pp_key_event); | |
49 if (keycode != 0) | |
50 key_event.set_usb_keycode(keycode); | |
51 key_event.set_pressed(event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN); | 48 key_event.set_pressed(event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN); |
52 input_stub_->InjectKeyEvent(key_event); | 49 input_stub_->InjectKeyEvent(key_event); |
53 return true; | 50 return true; |
54 } | 51 } |
55 | 52 |
56 case PP_INPUTEVENT_TYPE_MOUSEDOWN: | 53 case PP_INPUTEVENT_TYPE_MOUSEDOWN: |
57 case PP_INPUTEVENT_TYPE_MOUSEUP: { | 54 case PP_INPUTEVENT_TYPE_MOUSEUP: { |
58 pp::MouseInputEvent pp_mouse_event(event); | 55 pp::MouseInputEvent pp_mouse_event(event); |
59 protocol::MouseEvent mouse_event; | 56 protocol::MouseEvent mouse_event; |
60 switch (pp_mouse_event.GetButton()) { | 57 switch (pp_mouse_event.GetButton()) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 default: { | 115 default: { |
119 LOG(INFO) << "Unhandled input event: " << event.GetType(); | 116 LOG(INFO) << "Unhandled input event: " << event.GetType(); |
120 break; | 117 break; |
121 } | 118 } |
122 } | 119 } |
123 | 120 |
124 return false; | 121 return false; |
125 } | 122 } |
126 | 123 |
127 } // namespace remoting | 124 } // namespace remoting |
OLD | NEW |