Reorder mouse processor ops
Group the mouse events callbacks before the touch event callback.
This commit is contained in:
parent
96e0e89740
commit
3c15cbdaf8
2 changed files with 26 additions and 26 deletions
|
@ -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
|
static void
|
||||||
sc_mouse_processor_process_mouse_click(struct sc_mouse_processor *mp,
|
sc_mouse_processor_process_mouse_click(struct sc_mouse_processor *mp,
|
||||||
const struct sc_mouse_click_event *event) {
|
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
|
void
|
||||||
sc_mouse_inject_init(struct sc_mouse_inject *mi,
|
sc_mouse_inject_init(struct sc_mouse_inject *mi,
|
||||||
struct controller *controller) {
|
struct controller *controller) {
|
||||||
|
@ -144,9 +144,9 @@ sc_mouse_inject_init(struct sc_mouse_inject *mi,
|
||||||
|
|
||||||
static const struct sc_mouse_processor_ops ops = {
|
static const struct sc_mouse_processor_ops ops = {
|
||||||
.process_mouse_motion = sc_mouse_processor_process_mouse_motion,
|
.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_click = sc_mouse_processor_process_mouse_click,
|
||||||
.process_mouse_scroll = sc_mouse_processor_process_mouse_scroll,
|
.process_mouse_scroll = sc_mouse_processor_process_mouse_scroll,
|
||||||
|
.process_touch = sc_mouse_processor_process_touch,
|
||||||
};
|
};
|
||||||
|
|
||||||
mi->mouse_processor.ops = &ops;
|
mi->mouse_processor.ops = &ops;
|
||||||
|
|
|
@ -23,10 +23,6 @@ struct sc_mouse_processor_ops {
|
||||||
(*process_mouse_motion)(struct sc_mouse_processor *mp,
|
(*process_mouse_motion)(struct sc_mouse_processor *mp,
|
||||||
const struct sc_mouse_motion_event *event);
|
const struct sc_mouse_motion_event *event);
|
||||||
|
|
||||||
void
|
|
||||||
(*process_touch)(struct sc_mouse_processor *mp,
|
|
||||||
const struct sc_touch_event *event);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
(*process_mouse_click)(struct sc_mouse_processor *mp,
|
(*process_mouse_click)(struct sc_mouse_processor *mp,
|
||||||
const struct sc_mouse_click_event *event);
|
const struct sc_mouse_click_event *event);
|
||||||
|
@ -34,6 +30,10 @@ struct sc_mouse_processor_ops {
|
||||||
void
|
void
|
||||||
(*process_mouse_scroll)(struct sc_mouse_processor *mp,
|
(*process_mouse_scroll)(struct sc_mouse_processor *mp,
|
||||||
const struct sc_mouse_scroll_event *event);
|
const struct sc_mouse_scroll_event *event);
|
||||||
|
|
||||||
|
void
|
||||||
|
(*process_touch)(struct sc_mouse_processor *mp,
|
||||||
|
const struct sc_touch_event *event);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue