[client] x11: Add event handling for ungrabed mouse press/release

The imgui overlay requires input even if the display is not captured and
operating in raw mode. XInput2 correctly only sends
XI_Press/ReleaseButton events if the device has not been captured, as
such it's safe to handle both raw and non raw buttons events at the same
time.
This commit is contained in:
Geoffrey McRae 2021-07-31 15:23:31 +10:00
parent 75e57baf6c
commit 7f6fd02d06

View file

@ -388,7 +388,9 @@ static bool x11Init(const LG_DSInitParams params)
XISetMask(mask, XI_Leave );
XISetMask(mask, XI_Motion );
XISetMask(mask, XI_KeyPress );
XISetMask(mask, XI_KeyRelease);
XISetMask(mask, XI_KeyRelease );
XISetMask(mask, XI_ButtonPress );
XISetMask(mask, XI_ButtonRelease);
if (XISelectEvents(x11.display, x11.window, &eventmask, 1) != Success)
{
@ -802,6 +804,26 @@ static void x11GenericEvent(XGenericEventCookie *cookie)
return;
}
case XI_ButtonPress:
{
if (!x11.focused || !x11.entered)
return;
XIDeviceEvent *device = cookie->data;
app_handleButtonPress(device->detail);
return;
}
case XI_ButtonRelease:
{
if (!x11.focused || !x11.entered)
return;
XIDeviceEvent *device = cookie->data;
app_handleButtonRelease(device->detail);
return;
}
case XI_RawButtonPress:
{
if (!x11.focused || !x11.entered)