mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 14:40:26 +01:00
tablet: after three valid prox out events, unload the forced prox plugin
Once we receive three valid proximity out events for the pen, unload the plugin that generates forced proximity in events for tablets that don't send BTN_TOOL_PEN. Closes #1222 Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1370>
This commit is contained in:
parent
1e8901d009
commit
49d9528bdf
1 changed files with 18 additions and 0 deletions
|
|
@ -54,6 +54,7 @@ struct plugin_device {
|
|||
struct libinput_device *device;
|
||||
bitmask_t tool_state;
|
||||
bool pen_forced_into_proximity;
|
||||
size_t pen_prox_out_events;
|
||||
};
|
||||
|
||||
struct plugin_data {
|
||||
|
|
@ -121,6 +122,23 @@ forced_tool_plugin_device_handle_frame(struct libinput_plugin *libinput_plugin,
|
|||
} else {
|
||||
bitmask_clear_bit(&device->tool_state, BTN_TOOL_PEN);
|
||||
device->pen_forced_into_proximity = false;
|
||||
|
||||
/* If we get three valid pen proximity out events, let's
|
||||
* assume this device works fine and disable our plugin
|
||||
*/
|
||||
if (++device->pen_prox_out_events > 2) {
|
||||
plugin_log_debug(
|
||||
libinput_plugin,
|
||||
"%s: forced tool handling unloaded\n",
|
||||
libinput_device_get_name(
|
||||
device->device));
|
||||
libinput_plugin_enable_device_event_frame(
|
||||
libinput_plugin,
|
||||
device->device,
|
||||
false);
|
||||
plugin_device_destroy(device);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return; /* Nothing to do */
|
||||
case EVDEV_BTN_TOOL_RUBBER:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue