mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 12:40:05 +01:00
plugin: don't register the mouse-wheel plugin for passthrough devices
If a device is immediately set to PASSTHROUGH let's skip registering this plugin for this device. We're not doing anything with the events anyway. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1300>
This commit is contained in:
parent
b2cd9c69a0
commit
2f2bd357bc
1 changed files with 17 additions and 20 deletions
|
|
@ -64,7 +64,6 @@ enum wheel_event {
|
||||||
|
|
||||||
enum ignore_strategy {
|
enum ignore_strategy {
|
||||||
MAYBE = 1, /* use heuristics but don't yet accumulate */
|
MAYBE = 1, /* use heuristics but don't yet accumulate */
|
||||||
PASSTHROUGH, /* do not accumulate, pass through */
|
|
||||||
ACCUMULATE, /* accumulate scroll wheel events */
|
ACCUMULATE, /* accumulate scroll wheel events */
|
||||||
ALWAYS_ACCUMULATE, /* always accumulate wheel events */
|
ALWAYS_ACCUMULATE, /* always accumulate wheel events */
|
||||||
};
|
};
|
||||||
|
|
@ -174,7 +173,6 @@ wheel_handle_event_on_state_none(struct plugin_device *pd,
|
||||||
case ALWAYS_ACCUMULATE:
|
case ALWAYS_ACCUMULATE:
|
||||||
pd->state = WHEEL_STATE_ACCUMULATING_SCROLL;
|
pd->state = WHEEL_STATE_ACCUMULATING_SCROLL;
|
||||||
break;
|
break;
|
||||||
case PASSTHROUGH:
|
|
||||||
case MAYBE:
|
case MAYBE:
|
||||||
pd->state = WHEEL_STATE_SCROLLING;
|
pd->state = WHEEL_STATE_SCROLLING;
|
||||||
break;
|
break;
|
||||||
|
|
@ -462,8 +460,10 @@ wheel_plugin_device_create(struct libinput_plugin *libinput_plugin,
|
||||||
struct libinput_device *device)
|
struct libinput_device *device)
|
||||||
{
|
{
|
||||||
struct evdev_device *evdev = evdev_device(device);
|
struct evdev_device *evdev = evdev_device(device);
|
||||||
struct plugin_device *pd = zalloc(sizeof(*pd));
|
if (evdev_device_is_virtual(evdev))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
struct plugin_device *pd = zalloc(sizeof(*pd));
|
||||||
pd->parent = plugin;
|
pd->parent = plugin;
|
||||||
pd->device = libinput_device_ref(device);
|
pd->device = libinput_device_ref(device);
|
||||||
pd->state = WHEEL_STATE_NONE;
|
pd->state = WHEEL_STATE_NONE;
|
||||||
|
|
@ -471,22 +471,16 @@ wheel_plugin_device_create(struct libinput_plugin *libinput_plugin,
|
||||||
pd->min_movement = ACC_V120_THRESHOLD;
|
pd->min_movement = ACC_V120_THRESHOLD;
|
||||||
ratelimit_init(&pd->hires_warning_limit, s2us(24 * 60 * 60), 1);
|
ratelimit_init(&pd->hires_warning_limit, s2us(24 * 60 * 60), 1);
|
||||||
|
|
||||||
if (evdev_device_is_virtual(evdev))
|
if (libinput_device_has_model_quirk(device, QUIRK_MODEL_LOGITECH_MX_MASTER_3))
|
||||||
pd->ignore_small_hi_res_movements = PASSTHROUGH;
|
|
||||||
else if (libinput_device_has_model_quirk(device,
|
|
||||||
QUIRK_MODEL_LOGITECH_MX_MASTER_3))
|
|
||||||
pd->ignore_small_hi_res_movements = ALWAYS_ACCUMULATE;
|
pd->ignore_small_hi_res_movements = ALWAYS_ACCUMULATE;
|
||||||
else
|
else
|
||||||
pd->ignore_small_hi_res_movements = MAYBE;
|
pd->ignore_small_hi_res_movements = MAYBE;
|
||||||
|
|
||||||
if (pd->ignore_small_hi_res_movements != PASSTHROUGH) {
|
|
||||||
pd->scroll_timer =
|
pd->scroll_timer =
|
||||||
libinput_plugin_timer_new(libinput_plugin,
|
libinput_plugin_timer_new(libinput_plugin,
|
||||||
libinput_device_get_sysname(device),
|
libinput_device_get_sysname(device),
|
||||||
wheel_on_scroll_timer_timeout,
|
wheel_on_scroll_timer_timeout,
|
||||||
pd);
|
pd);
|
||||||
}
|
|
||||||
|
|
||||||
return pd;
|
return pd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -528,17 +522,20 @@ wheel_plugin_device_new(struct libinput_plugin *libinput_plugin,
|
||||||
!libevdev_has_event_code(libevdev, EV_REL, REL_HWHEEL_HI_RES))
|
!libevdev_has_event_code(libevdev, EV_REL, REL_HWHEEL_HI_RES))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
struct plugin_data *plugin = libinput_plugin_get_user_data(libinput_plugin);
|
||||||
|
struct plugin_device *pd =
|
||||||
|
wheel_plugin_device_create(libinput_plugin, plugin, device);
|
||||||
|
if (!pd)
|
||||||
|
return;
|
||||||
|
|
||||||
|
list_take_append(&plugin->devices, pd, link);
|
||||||
|
|
||||||
libinput_plugin_enable_device_event_frame(libinput_plugin, device, true);
|
libinput_plugin_enable_device_event_frame(libinput_plugin, device, true);
|
||||||
|
|
||||||
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_WHEEL);
|
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_WHEEL);
|
||||||
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_WHEEL_HI_RES);
|
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_WHEEL_HI_RES);
|
||||||
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_HWHEEL);
|
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_HWHEEL);
|
||||||
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_HWHEEL_HI_RES);
|
libinput_plugin_enable_evdev_usage(libinput_plugin, EVDEV_REL_HWHEEL_HI_RES);
|
||||||
|
|
||||||
struct plugin_data *plugin = libinput_plugin_get_user_data(libinput_plugin);
|
|
||||||
struct plugin_device *pd =
|
|
||||||
wheel_plugin_device_create(libinput_plugin, plugin, device);
|
|
||||||
list_take_append(&plugin->devices, pd, link);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue