Skip to content

Display and control your Android device

Reorder mouse processor ops

Romain Vimont3c15cbdaf89d
diff --git a/app/src/mouse_inject.c b/app/src/mouse_inject.c
index 887fc0b1..1d14509d 100644
--- a/app/src/mouse_inject.c
+++ b/app/src/mouse_inject.c
@@ -76,27 +76,6 @@ sc_mouse_processor_process_mouse_motion(struct sc_mouse_processor *mp,
}
}
-static void
-sc_mouse_processor_process_touch(struct sc_mouse_processor *mp,
- const struct sc_touch_event *event) {
- struct sc_mouse_inject *mi = DOWNCAST(mp);
-
- struct control_msg msg = {
- .type = CONTROL_MSG_TYPE_INJECT_TOUCH_EVENT,
- .inject_touch_event = {
- .action = convert_touch_action(event->action),
- .pointer_id = event->pointer_id,
- .position = event->position,
- .pressure = event->pressure,
- .buttons = 0,
- },
- };
-
- if (!controller_push_msg(mi->controller, &msg)) {
- LOGW("Could not request 'inject touch event'");
- }
-}
-
static void
sc_mouse_processor_process_mouse_click(struct sc_mouse_processor *mp,
const struct sc_mouse_click_event *event) {
@@ -137,6 +116,27 @@ sc_mouse_processor_process_mouse_scroll(struct sc_mouse_processor *mp,
}
}
+static void
+sc_mouse_processor_process_touch(struct sc_mouse_processor *mp,
+ const struct sc_touch_event *event) {
+ struct sc_mouse_inject *mi = DOWNCAST(mp);
+
+ struct control_msg msg = {
+ .type = CONTROL_MSG_TYPE_INJECT_TOUCH_EVENT,
+ .inject_touch_event = {
+ .action = convert_touch_action(event->action),
+ .pointer_id = event->pointer_id,
+ .position = event->position,
+ .pressure = event->pressure,
+ .buttons = 0,
+ },
+ };
+
+ if (!controller_push_msg(mi->controller, &msg)) {
+ LOGW("Could not request 'inject touch event'");
+ }
+}
+
void
sc_mouse_inject_init(struct sc_mouse_inject *mi,
struct controller *controller) {
@@ -144,9 +144,9 @@ sc_mouse_inject_init(struct sc_mouse_inject *mi,
static const struct sc_mouse_processor_ops ops = {
.process_mouse_motion = sc_mouse_processor_process_mouse_motion,
- .process_touch = sc_mouse_processor_process_touch,
.process_mouse_click = sc_mouse_processor_process_mouse_click,
.process_mouse_scroll = sc_mouse_processor_process_mouse_scroll,
+ .process_touch = sc_mouse_processor_process_touch,
};
mi->mouse_processor.ops = &ops;
diff --git a/app/src/trait/mouse_processor.h b/app/src/trait/mouse_processor.h
index e06545bf..b08d15bb 100644
--- a/app/src/trait/mouse_processor.h
+++ b/app/src/trait/mouse_processor.h
@@ -23,10 +23,6 @@ struct sc_mouse_processor_ops {
(*process_mouse_motion)(struct sc_mouse_processor *mp,
const struct sc_mouse_motion_event *event);
- void
- (*process_touch)(struct sc_mouse_processor *mp,
- const struct sc_touch_event *event);
-
void
(*process_mouse_click)(struct sc_mouse_processor *mp,
const struct sc_mouse_click_event *event);
@@ -34,6 +30,10 @@ struct sc_mouse_processor_ops {
void
(*process_mouse_scroll)(struct sc_mouse_processor *mp,
const struct sc_mouse_scroll_event *event);
+
+ void
+ (*process_touch)(struct sc_mouse_processor *mp,
+ const struct sc_touch_event *event);
};
#endif