blob: 5599655fe89c1093f5613d6229a5c1f5977b608f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "remoting/client/plugin/pepper_input_handler.h"
#include "ppapi/c/pp_input_event.h"
namespace remoting {
PepperInputHandler::PepperInputHandler(ClientContext* context,
HostConnection* connection,
ChromotingView* view)
: InputHandler(context, connection, view) {
}
PepperInputHandler::~PepperInputHandler() {
}
void PepperInputHandler::Initialize() {
}
void PepperInputHandler::HandleKeyEvent(bool keydown,
const PP_InputEvent_Key& event) {
SendKeyEvent(keydown, event.key_code);
}
void PepperInputHandler::HandleCharacterEvent(
const PP_InputEvent_Character& event) {
// TODO(garykac): Coordinate key and char events.
}
void PepperInputHandler::HandleMouseMoveEvent(const PP_InputEvent_Mouse& event) {
SendMouseMoveEvent(static_cast<int>(event.x),
static_cast<int>(event.y));
}
void PepperInputHandler::HandleMouseButtonEvent(
bool button_down,
const PP_InputEvent_Mouse& event) {
MouseButton button = MouseButtonUndefined;
if (event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) {
button = MouseButtonLeft;
} else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) {
button = MouseButtonMiddle;
} else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) {
button = MouseButtonRight;
}
if (button != MouseButtonUndefined) {
SendMouseButtonEvent(button_down, button);
}
}
} // namespace remoting
|