Commit d8aef838 authored by Peter Hutterer's avatar Peter Hutterer

Fix proximity events

Two bugs caused proximity events to be discarded. First, on proximity out
posting through pDev would be discarded because pDev is the parent device that
we use as a base for hotplugging the real devices for each tool from. That
device never sends events though, doing so will see the event discarded in the

Second, if the tool already exists don't just exit, send the proximity event
first. To unify the three paths where we do send the events simply move them
down to the exit phase of the function. Peter Hutterer's avatarPeter Hutterer <>
parent 34b6ed98
......@@ -1492,18 +1492,13 @@ xf86libinput_handle_tablet_proximity(InputInfoPtr pInfo,
char name[64];
ValuatorMask *mask = driver_data->valuators;
double x, y;
BOOL in_prox;
x = libinput_event_tablet_tool_get_x_transformed(event, TABLET_AXIS_MAX);
y = libinput_event_tablet_tool_get_y_transformed(event, TABLET_AXIS_MAX);
valuator_mask_set_double(mask, 0, x);
valuator_mask_set_double(mask, 1, y);
if (libinput_event_tablet_tool_get_proximity_state(event) ==
xf86PostProximityEventM(pDev, FALSE, mask);
tool = libinput_event_tablet_tool_get_tool(event);
serial = libinput_tablet_tool_get_serial(tool);
tool_id = libinput_tablet_tool_get_tool_id(tool);
......@@ -1513,8 +1508,10 @@ xf86libinput_handle_tablet_proximity(InputInfoPtr pInfo,
shared_device_link) {
if (dev->tablet_tool &&
libinput_tablet_tool_get_serial(dev->tablet_tool) == serial &&
libinput_tablet_tool_get_tool_id(dev->tablet_tool) == tool_id)
libinput_tablet_tool_get_tool_id(dev->tablet_tool) == tool_id) {
pDev = dev->pInfo->dev;
goto out;
t = calloc(1, sizeof *t);
......@@ -1537,7 +1534,10 @@ xf86libinput_handle_tablet_proximity(InputInfoPtr pInfo,
pDev = xf86libinput_create_subdevice(pInfo, CAP_TABLET_TOOL, HOTPLUG_NOW, options);
xf86PostProximityEventM(pDev, TRUE, mask);
in_prox = libinput_event_tablet_tool_get_proximity_state(event) ==
xf86PostProximityEventM(pDev, in_prox, mask);
static void
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment