OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/cpp/input_event.h" | 7 #include "ppapi/cpp/input_event.h" |
8 #include "ppapi/cpp/point.h" | 8 #include "ppapi/cpp/point.h" |
9 #include "remoting/client/plugin/pepper_view_proxy.h" | 9 #include "remoting/client/plugin/pepper_view_proxy.h" |
10 | 10 |
11 namespace remoting { | 11 namespace remoting { |
12 | 12 |
13 using pp::KeyboardInputEvent; | |
14 using pp::MouseInputEvent; | |
15 using protocol::KeyEvent; | |
16 using protocol::MouseEvent; | 13 using protocol::MouseEvent; |
17 | 14 |
18 PepperInputHandler::PepperInputHandler(ClientContext* context, | 15 PepperInputHandler::PepperInputHandler(ClientContext* context, |
19 protocol::ConnectionToHost* connection, | 16 protocol::ConnectionToHost* connection, |
20 PepperViewProxy* view) | 17 PepperViewProxy* view) |
21 : InputHandler(context, connection, view), | 18 : InputHandler(context, connection, view), |
22 pepper_view_(view) { | 19 pepper_view_(view) { |
23 } | 20 } |
24 | 21 |
25 PepperInputHandler::~PepperInputHandler() { | 22 PepperInputHandler::~PepperInputHandler() { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 case PP_INPUTEVENT_MOUSEBUTTON_NONE: | 68 case PP_INPUTEVENT_MOUSEBUTTON_NONE: |
72 // Leave button undefined. | 69 // Leave button undefined. |
73 break; | 70 break; |
74 } | 71 } |
75 | 72 |
76 if (button != MouseEvent::BUTTON_UNDEFINED) { | 73 if (button != MouseEvent::BUTTON_UNDEFINED) { |
77 SendMouseButtonEvent(button_down, button); | 74 SendMouseButtonEvent(button_down, button); |
78 } | 75 } |
79 } | 76 } |
80 | 77 |
78 void PepperInputHandler::HandleMouseWheelEvent( | |
79 const pp::WheelInputEvent& event) { | |
80 pp::FloatPoint ticks = event.GetTicks(); | |
81 SendMouseWheelEvent(static_cast<int>(ticks.x()), | |
Wez
2011/10/13 00:38:01
Do we really want to static_cast<int>() these? Wo
Lambros
2011/10/13 01:10:23
I'm curious to know why these are floats in the fi
Wez
2011/10/13 01:20:05
Looking at the spec for GetTicks(), it seems that
garykac
2011/10/13 21:18:53
In practice, for a scroll wheel these are always i
garykac
2011/10/13 21:18:53
They're always integral values (stored as a float)
garykac
2011/10/13 21:18:53
Done.
| |
82 static_cast<int>(ticks.y())); | |
83 } | |
84 | |
81 } // namespace remoting | 85 } // namespace remoting |
OLD | NEW |