mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-25 00:00:14 +01:00
Drop struct input-event from dispatch->interface->process
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1215>
This commit is contained in:
parent
28ee82b6f1
commit
c821bbd8e4
8 changed files with 65 additions and 76 deletions
|
|
@ -978,14 +978,12 @@ fallback_handle_state(struct fallback_dispatch *dispatch,
|
|||
static void
|
||||
fallback_interface_process(struct evdev_dispatch *evdev_dispatch,
|
||||
struct evdev_device *device,
|
||||
struct input_event *input_event,
|
||||
struct evdev_event *event,
|
||||
uint64_t time)
|
||||
{
|
||||
struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
|
||||
static bool warned = false;
|
||||
|
||||
struct evdev_event event = evdev_event_from_input_event(input_event, NULL);
|
||||
|
||||
if (dispatch->arbitration.in_arbitration) {
|
||||
if (!warned) {
|
||||
evdev_log_debug(device, "dropping events due to touch arbitration\n");
|
||||
|
|
@ -996,19 +994,19 @@ fallback_interface_process(struct evdev_dispatch *evdev_dispatch,
|
|||
|
||||
warned = false;
|
||||
|
||||
uint16_t type = evdev_event_type(&event);
|
||||
uint16_t type = evdev_event_type(event);
|
||||
switch (type) {
|
||||
case EV_REL:
|
||||
fallback_process_relative(dispatch, device, &event, time);
|
||||
fallback_process_relative(dispatch, device, event, time);
|
||||
break;
|
||||
case EV_ABS:
|
||||
fallback_process_absolute(dispatch, device, &event, time);
|
||||
fallback_process_absolute(dispatch, device, event, time);
|
||||
break;
|
||||
case EV_KEY:
|
||||
fallback_process_key(dispatch, device, &event, time);
|
||||
fallback_process_key(dispatch, device, event, time);
|
||||
break;
|
||||
case EV_SW:
|
||||
fallback_process_switch(dispatch, device, &event, time);
|
||||
fallback_process_switch(dispatch, device, event, time);
|
||||
break;
|
||||
case EV_SYN:
|
||||
fallback_handle_state(dispatch, device, time);
|
||||
|
|
|
|||
|
|
@ -1232,12 +1232,15 @@ tp_notify_clickpadbutton(struct tp_dispatch *tp,
|
|||
if (tp->buttons.trackpoint) {
|
||||
if (is_topbutton) {
|
||||
struct evdev_dispatch *dispatch = tp->buttons.trackpoint->dispatch;
|
||||
struct input_event event, syn_report;
|
||||
int value;
|
||||
|
||||
value = (state == LIBINPUT_BUTTON_STATE_PRESSED) ? 1 : 0;
|
||||
event = input_event_init(time, EV_KEY, evdev_usage_code(button), value);
|
||||
syn_report = input_event_init(time, EV_SYN, SYN_REPORT, 0);
|
||||
int value = (state == LIBINPUT_BUTTON_STATE_PRESSED) ? 1 : 0;
|
||||
struct evdev_event event = {
|
||||
.usage = button,
|
||||
.value = value,
|
||||
};
|
||||
struct evdev_event syn_report = {
|
||||
.usage = evdev_usage_from(EVDEV_SYN_REPORT),
|
||||
.value = 0,
|
||||
};
|
||||
dispatch->interface->process(dispatch,
|
||||
tp->buttons.trackpoint,
|
||||
&event,
|
||||
|
|
|
|||
|
|
@ -717,38 +717,36 @@ tp_process_trackpoint_button(struct tp_dispatch *tp,
|
|||
uint64_t time)
|
||||
{
|
||||
struct evdev_dispatch *dispatch;
|
||||
struct input_event event;
|
||||
struct input_event syn_report = {
|
||||
.input_event_sec = 0,
|
||||
.input_event_usec = 0,
|
||||
.type = EV_SYN,
|
||||
.code = SYN_REPORT,
|
||||
.value = 0
|
||||
};
|
||||
evdev_usage_t button;
|
||||
|
||||
if (!tp->buttons.trackpoint)
|
||||
return;
|
||||
|
||||
dispatch = tp->buttons.trackpoint->dispatch;
|
||||
|
||||
event = evdev_event_to_input_event(e, time);
|
||||
syn_report.input_event_sec = event.input_event_sec;
|
||||
syn_report.input_event_usec = event.input_event_usec;
|
||||
|
||||
switch (evdev_usage_enum(e->usage)) {
|
||||
case EVDEV_BTN_0:
|
||||
event.code = BTN_LEFT;
|
||||
button = evdev_usage_from(EVDEV_BTN_LEFT);
|
||||
break;
|
||||
case EVDEV_BTN_1:
|
||||
event.code = BTN_RIGHT;
|
||||
button = evdev_usage_from(EVDEV_BTN_RIGHT);
|
||||
break;
|
||||
case EVDEV_BTN_2:
|
||||
event.code = BTN_MIDDLE;
|
||||
button = evdev_usage_from(EVDEV_BTN_MIDDLE);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
struct evdev_event event = {
|
||||
.usage = button,
|
||||
.value = e->value
|
||||
};
|
||||
struct evdev_event syn_report = {
|
||||
.usage = evdev_usage_from(EVDEV_SYN_REPORT),
|
||||
.value = 0
|
||||
};
|
||||
|
||||
dispatch->interface->process(dispatch,
|
||||
tp->buttons.trackpoint,
|
||||
&event, time);
|
||||
|
|
@ -1945,25 +1943,24 @@ tp_debug_touch_state(struct tp_dispatch *tp,
|
|||
static void
|
||||
tp_interface_process(struct evdev_dispatch *dispatch,
|
||||
struct evdev_device *device,
|
||||
struct input_event *input_event,
|
||||
struct evdev_event *e,
|
||||
uint64_t time)
|
||||
{
|
||||
struct tp_dispatch *tp = tp_dispatch(dispatch);
|
||||
struct evdev_event e = evdev_event_from_input_event(input_event, NULL);
|
||||
|
||||
uint16_t type = evdev_event_type(&e);
|
||||
uint16_t type = evdev_event_type(e);
|
||||
switch (type) {
|
||||
case EV_ABS:
|
||||
if (tp->has_mt)
|
||||
tp_process_absolute(tp, &e, time);
|
||||
tp_process_absolute(tp, e, time);
|
||||
else
|
||||
tp_process_absolute_st(tp, &e, time);
|
||||
tp_process_absolute_st(tp, e, time);
|
||||
break;
|
||||
case EV_KEY:
|
||||
tp_process_key(tp, &e, time);
|
||||
tp_process_key(tp, e, time);
|
||||
break;
|
||||
case EV_MSC:
|
||||
tp_process_msc(tp, &e, time);
|
||||
tp_process_msc(tp, e, time);
|
||||
break;
|
||||
case EV_SYN:
|
||||
tp_handle_state(tp, time);
|
||||
|
|
|
|||
|
|
@ -591,23 +591,21 @@ pad_flush(struct pad_dispatch *pad,
|
|||
static void
|
||||
pad_process(struct evdev_dispatch *dispatch,
|
||||
struct evdev_device *device,
|
||||
struct input_event *input_event,
|
||||
struct evdev_event *e,
|
||||
uint64_t time)
|
||||
{
|
||||
struct pad_dispatch *pad = pad_dispatch(dispatch);
|
||||
|
||||
struct evdev_event e = evdev_event_from_input_event(input_event, NULL);
|
||||
|
||||
uint16_t type = evdev_event_type(&e);
|
||||
uint16_t type = evdev_event_type(e);
|
||||
switch (type) {
|
||||
case EV_REL:
|
||||
pad_process_relative(pad, device, &e, time);
|
||||
pad_process_relative(pad, device, e, time);
|
||||
break;
|
||||
case EV_ABS:
|
||||
pad_process_absolute(pad, device, &e, time);
|
||||
pad_process_absolute(pad, device, e, time);
|
||||
break;
|
||||
case EV_KEY:
|
||||
pad_process_key(pad, device, &e, time);
|
||||
pad_process_key(pad, device, e, time);
|
||||
break;
|
||||
case EV_SYN:
|
||||
pad_flush(pad, device, time);
|
||||
|
|
@ -620,7 +618,7 @@ pad_process(struct evdev_dispatch *dispatch,
|
|||
evdev_log_error(device,
|
||||
"Unexpected event type %s (%#x)\n",
|
||||
libevdev_event_type_get_name(type),
|
||||
evdev_usage_as_uint32_t(e.usage));
|
||||
evdev_usage_as_uint32_t(e->usage));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2343,18 +2343,15 @@ static void
|
|||
tablet_proximity_out_quirk_timer_func(uint64_t now, void *data)
|
||||
{
|
||||
struct tablet_dispatch *tablet = data;
|
||||
struct timeval tv = us2tv(now);
|
||||
struct input_event events[2] = {
|
||||
{ .input_event_sec = tv.tv_sec,
|
||||
.input_event_usec = tv.tv_usec,
|
||||
.type = EV_KEY,
|
||||
.code = BTN_TOOL_PEN,
|
||||
.value = 0 },
|
||||
{ .input_event_sec = tv.tv_sec,
|
||||
.input_event_usec = tv.tv_usec,
|
||||
.type = EV_SYN,
|
||||
.code = SYN_REPORT,
|
||||
.value = 0 },
|
||||
struct evdev_event events[2] = {
|
||||
{
|
||||
.usage = evdev_usage_from(EVDEV_BTN_TOOL_PEN),
|
||||
.value = 0
|
||||
},
|
||||
{
|
||||
.usage = evdev_usage_from(EVDEV_SYN_REPORT),
|
||||
.value = 0,
|
||||
}
|
||||
};
|
||||
|
||||
if (tablet_has_status(tablet, TABLET_TOOL_IN_CONTACT) ||
|
||||
|
|
@ -2386,25 +2383,24 @@ tablet_proximity_out_quirk_timer_func(uint64_t now, void *data)
|
|||
static void
|
||||
tablet_process(struct evdev_dispatch *dispatch,
|
||||
struct evdev_device *device,
|
||||
struct input_event *input_event,
|
||||
struct evdev_event *e,
|
||||
uint64_t time)
|
||||
{
|
||||
struct tablet_dispatch *tablet = tablet_dispatch(dispatch);
|
||||
|
||||
struct evdev_event e = evdev_event_from_input_event(input_event, NULL);
|
||||
uint16_t type = evdev_event_type(&e);
|
||||
uint16_t type = evdev_event_type(e);
|
||||
switch (type) {
|
||||
case EV_ABS:
|
||||
tablet_process_absolute(tablet, device, &e, time);
|
||||
tablet_process_absolute(tablet, device, e, time);
|
||||
break;
|
||||
case EV_REL:
|
||||
tablet_process_relative(tablet, device, &e, time);
|
||||
tablet_process_relative(tablet, device, e, time);
|
||||
break;
|
||||
case EV_KEY:
|
||||
tablet_process_key(tablet, device, &e, time);
|
||||
tablet_process_key(tablet, device, e, time);
|
||||
break;
|
||||
case EV_MSC:
|
||||
tablet_process_misc(tablet, device, &e, time);
|
||||
tablet_process_misc(tablet, device, e, time);
|
||||
break;
|
||||
case EV_SYN:
|
||||
tablet_flush(tablet, device, time);
|
||||
|
|
@ -2415,8 +2411,8 @@ tablet_process(struct evdev_dispatch *dispatch,
|
|||
default:
|
||||
evdev_log_error(device,
|
||||
"Unexpected event type %s (%#x)\n",
|
||||
evdev_event_get_type_name(&e),
|
||||
evdev_event_type(&e));
|
||||
evdev_event_get_type_name(e),
|
||||
evdev_event_type(e));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -527,22 +527,20 @@ totem_handle_state(struct totem_dispatch *totem,
|
|||
static void
|
||||
totem_interface_process(struct evdev_dispatch *dispatch,
|
||||
struct evdev_device *device,
|
||||
struct input_event *input_event,
|
||||
struct evdev_event *e,
|
||||
uint64_t time)
|
||||
{
|
||||
struct totem_dispatch *totem = totem_dispatch(dispatch);
|
||||
enum totem_slot_state global_state;
|
||||
bool enable_touch;
|
||||
|
||||
struct evdev_event e = evdev_event_from_input_event(input_event, NULL);
|
||||
|
||||
uint16_t type = evdev_event_type(&e);
|
||||
uint16_t type = evdev_event_type(e);
|
||||
switch(type) {
|
||||
case EV_ABS:
|
||||
totem_process_abs(totem, device, &e, time);
|
||||
totem_process_abs(totem, device, e, time);
|
||||
break;
|
||||
case EV_KEY:
|
||||
totem_process_key(totem, device, &e, time);
|
||||
totem_process_key(totem, device, e, time);
|
||||
break;
|
||||
case EV_MSC:
|
||||
/* timestamp, ignore */
|
||||
|
|
@ -557,8 +555,8 @@ totem_interface_process(struct evdev_dispatch *dispatch,
|
|||
default:
|
||||
evdev_log_error(device,
|
||||
"Unexpected event %s (%#x)\n",
|
||||
evdev_event_get_code_name(&e),
|
||||
evdev_usage_as_uint32_t(e.usage));
|
||||
evdev_event_get_code_name(e),
|
||||
evdev_usage_as_uint32_t(e->usage));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1090,8 +1090,7 @@ evdev_process_event(struct evdev_device *device,
|
|||
|
||||
libinput_timer_flush(evdev_libinput_context(device), time);
|
||||
|
||||
struct input_event ev = evdev_event_to_input_event(e, time);
|
||||
dispatch->interface->process(dispatch, device, &ev, time);
|
||||
dispatch->interface->process(dispatch, device, e, time);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ struct evdev_dispatch_interface {
|
|||
/* Process an evdev input event. */
|
||||
void (*process)(struct evdev_dispatch *dispatch,
|
||||
struct evdev_device *device,
|
||||
struct input_event *event,
|
||||
struct evdev_event *event,
|
||||
uint64_t time);
|
||||
|
||||
/* Device is being suspended */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue