1 #include "VirtualTouchpadClient.h"
2 #include "dvr/virtual_touchpad_client.h"
3
4 struct DvrVirtualTouchpad {};
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 namespace {
FromC(DvrVirtualTouchpad * client)11 android::dvr::VirtualTouchpad* FromC(DvrVirtualTouchpad* client) {
12 return reinterpret_cast<android::dvr::VirtualTouchpad*>(client);
13 }
14 } // namespace
15
dvrVirtualTouchpadCreate()16 DvrVirtualTouchpad* dvrVirtualTouchpadCreate() {
17 return reinterpret_cast<DvrVirtualTouchpad*>(
18 android::dvr::VirtualTouchpadClient::Create().release());
19 }
20
dvrVirtualTouchpadDestroy(DvrVirtualTouchpad * client)21 void dvrVirtualTouchpadDestroy(DvrVirtualTouchpad* client) {
22 delete FromC(client);
23 }
24
dvrVirtualTouchpadAttach(DvrVirtualTouchpad * client)25 int dvrVirtualTouchpadAttach(DvrVirtualTouchpad* client) {
26 return FromC(client)->Attach();
27 }
28
dvrVirtualTouchpadDetach(DvrVirtualTouchpad * client)29 int dvrVirtualTouchpadDetach(DvrVirtualTouchpad* client) {
30 return FromC(client)->Detach();
31 }
32
dvrVirtualTouchpadTouch(DvrVirtualTouchpad * client,int touchpad,float x,float y,float pressure)33 int dvrVirtualTouchpadTouch(DvrVirtualTouchpad* client, int touchpad, float x,
34 float y, float pressure) {
35 return FromC(client)->Touch(touchpad, x, y, pressure);
36 }
37
dvrVirtualTouchpadButtonState(DvrVirtualTouchpad * client,int touchpad,int buttons)38 int dvrVirtualTouchpadButtonState(DvrVirtualTouchpad* client, int touchpad,
39 int buttons) {
40 return FromC(client)->ButtonState(touchpad, buttons);
41 }
42
dvrVirtualTouchpadScroll(DvrVirtualTouchpad * client,int touchpad,float x,float y)43 int dvrVirtualTouchpadScroll(DvrVirtualTouchpad* client, int touchpad, float x,
44 float y) {
45 return FromC(client)->Scroll(touchpad, x, y);
46 }
47
48 #ifdef __cplusplus
49 } // extern "C"
50 #endif
51