mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] x11: work around issue with desktop switch on i3
For an unknwon reason when LG is on another desktop (hidden) and the user switches to that desktop, the first attempt to grab the pointer results in a GrabFrozen result. This adds some simple retry logic to attempt again after a short (100ms) delay which seems to resolve the issue.
This commit is contained in:
parent
2e170ad06f
commit
b6fa296d5a
@ -1643,7 +1643,10 @@ static void x11GrabPointer(void)
|
|||||||
XISetMask(mask.mask, XI_Enter );
|
XISetMask(mask.mask, XI_Enter );
|
||||||
XISetMask(mask.mask, XI_Leave );
|
XISetMask(mask.mask, XI_Leave );
|
||||||
|
|
||||||
Status ret = XIGrabDevice(
|
Status ret;
|
||||||
|
for(int retry = 0; retry < 2; ++retry)
|
||||||
|
{
|
||||||
|
ret = XIGrabDevice(
|
||||||
x11.display,
|
x11.display,
|
||||||
x11.pointerDev,
|
x11.pointerDev,
|
||||||
x11.window,
|
x11.window,
|
||||||
@ -1654,6 +1657,13 @@ static void x11GrabPointer(void)
|
|||||||
XINoOwnerEvents,
|
XINoOwnerEvents,
|
||||||
&mask);
|
&mask);
|
||||||
|
|
||||||
|
// on some WMs (i3) for an unknown reason the first grab attempt when
|
||||||
|
// switching to a desktop that has LG on it fails with GrabFrozen, however
|
||||||
|
// adding as short delay seems to resolve the issue.
|
||||||
|
if (ret == GrabFrozen && retry == 0)
|
||||||
|
usleep(100000);
|
||||||
|
}
|
||||||
|
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
{
|
{
|
||||||
x11PrintGrabError("pointer", x11.pointerDev, ret);
|
x11PrintGrabError("pointer", x11.pointerDev, ret);
|
||||||
|
Loading…
Reference in New Issue
Block a user