summaryrefslogtreecommitdiffstats
path: root/remoting/client/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/client/plugin')
-rw-r--r--remoting/client/plugin/chromoting_instance.cc10
-rw-r--r--remoting/client/plugin/pepper_input_handler.cc22
-rw-r--r--remoting/client/plugin/pepper_input_handler.h6
3 files changed, 36 insertions, 2 deletions
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index 6cbc510..edde1f3 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -115,15 +115,23 @@ bool ChromotingInstance::CurrentlyOnPluginThread() const {
bool ChromotingInstance::HandleEvent(const PP_Event& event) {
DCHECK(CurrentlyOnPluginThread());
+ PepperInputHandler* pih
+ = static_cast<PepperInputHandler*>(input_handler_.get());
+
switch (event.type) {
case PP_EVENT_TYPE_MOUSEDOWN:
+ pih->HandleMouseButtonEvent(true, event.u.mouse);
+ break;
case PP_EVENT_TYPE_MOUSEUP:
+ pih->HandleMouseButtonEvent(false, event.u.mouse);
+ break;
case PP_EVENT_TYPE_MOUSEMOVE:
case PP_EVENT_TYPE_MOUSEENTER:
case PP_EVENT_TYPE_MOUSELEAVE:
- // client_->handle_mouse_event(npevent);
+ pih->HandleMouseMoveEvent(event.u.mouse);
break;
+ case PP_EVENT_TYPE_KEYDOWN:
case PP_EVENT_TYPE_CHAR:
// client_->handle_char_event(npevent);
break;
diff --git a/remoting/client/plugin/pepper_input_handler.cc b/remoting/client/plugin/pepper_input_handler.cc
index 96e8149..40f299e 100644
--- a/remoting/client/plugin/pepper_input_handler.cc
+++ b/remoting/client/plugin/pepper_input_handler.cc
@@ -16,7 +16,27 @@ PepperInputHandler::~PepperInputHandler() {
}
void PepperInputHandler::Initialize() {
- // TODO(garykac): Implement this.
+}
+
+void PepperInputHandler::HandleMouseMoveEvent(const PP_Event_Mouse& event) {
+ SendMouseMoveEvent(static_cast<int>(event.x),
+ static_cast<int>(event.y));
+}
+
+void PepperInputHandler::HandleMouseButtonEvent(bool button_down,
+ const PP_Event_Mouse& event) {
+ MouseButton button = MouseButtonUndefined;
+ if (event.button == PP_EVENT_MOUSEBUTTON_LEFT) {
+ button = MouseButtonLeft;
+ } else if (event.button == PP_EVENT_MOUSEBUTTON_MIDDLE) {
+ button = MouseButtonMiddle;
+ } else if (event.button == PP_EVENT_MOUSEBUTTON_RIGHT) {
+ button = MouseButtonRight;
+ }
+
+ if (button != MouseButtonUndefined) {
+ SendMouseButtonEvent(button_down, button);
+ }
}
} // namespace remoting
diff --git a/remoting/client/plugin/pepper_input_handler.h b/remoting/client/plugin/pepper_input_handler.h
index 4db2f87..385cb8a 100644
--- a/remoting/client/plugin/pepper_input_handler.h
+++ b/remoting/client/plugin/pepper_input_handler.h
@@ -7,6 +7,8 @@
#include "remoting/client/input_handler.h"
+#include "third_party/ppapi/c/pp_event.h"
+
namespace remoting {
class PepperInputHandler : public InputHandler {
@@ -18,6 +20,10 @@ class PepperInputHandler : public InputHandler {
void Initialize();
+ void HandleMouseMoveEvent(const PP_Event_Mouse& event);
+ void HandleMouseButtonEvent(bool button_down,
+ const PP_Event_Mouse& event);
+
private:
DISALLOW_COPY_AND_ASSIGN(PepperInputHandler);
};