mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 06:47:19 +00:00
[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:
parent
75e57baf6c
commit
7f6fd02d06
@ -382,13 +382,15 @@ static bool x11Init(const LG_DSInitParams params)
|
||||
eventmask.mask_len = sizeof(mask);
|
||||
eventmask.mask = mask;
|
||||
|
||||
XISetMask(mask, XI_FocusIn );
|
||||
XISetMask(mask, XI_FocusOut );
|
||||
XISetMask(mask, XI_Enter );
|
||||
XISetMask(mask, XI_Leave );
|
||||
XISetMask(mask, XI_Motion );
|
||||
XISetMask(mask, XI_KeyPress );
|
||||
XISetMask(mask, XI_KeyRelease);
|
||||
XISetMask(mask, XI_FocusIn );
|
||||
XISetMask(mask, XI_FocusOut );
|
||||
XISetMask(mask, XI_Enter );
|
||||
XISetMask(mask, XI_Leave );
|
||||
XISetMask(mask, XI_Motion );
|
||||
XISetMask(mask, XI_KeyPress );
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user