[client] wayland: fix deadlock when using wayland:warpSupport=no

This commit is contained in:
Quantum 2021-08-11 01:43:59 -04:00 committed by Geoffrey McRae
parent f0ea882165
commit 22bbc2457e

View File

@ -344,16 +344,19 @@ void waylandGrabPointer(void)
}); });
} }
void waylandUngrabPointer(void) inline static void internalUngrabPointer(bool lock)
{ {
INTERLOCKED_SECTION(wlWm.confineLock, if (lock)
LG_LOCK(wlWm.confineLock);
if (wlWm.confinedPointer)
{ {
if (wlWm.confinedPointer) zwp_confined_pointer_v1_destroy(wlWm.confinedPointer);
{ wlWm.confinedPointer = NULL;
zwp_confined_pointer_v1_destroy(wlWm.confinedPointer); }
wlWm.confinedPointer = NULL;
} if (lock)
}); LG_UNLOCK(wlWm.confineLock);
if (!wlWm.warpSupport) if (!wlWm.warpSupport)
{ {
@ -371,6 +374,11 @@ void waylandUngrabPointer(void)
} }
} }
void waylandUngrabPointer(void)
{
internalUngrabPointer(true);
}
void waylandCapturePointer(void) void waylandCapturePointer(void)
{ {
if (!wlWm.warpSupport) if (!wlWm.warpSupport)
@ -411,9 +419,7 @@ void waylandUncapturePointer(void)
* - if the user has opted to use captureInputOnly mode. * - if the user has opted to use captureInputOnly mode.
*/ */
if (!wlWm.warpSupport || !app_isFormatValid() || app_isCaptureOnlyMode()) if (!wlWm.warpSupport || !app_isFormatValid() || app_isCaptureOnlyMode())
{ internalUngrabPointer(false);
waylandUngrabPointer();
}
else else
{ {
wlWm.confinedPointer = zwp_pointer_constraints_v1_confine_pointer( wlWm.confinedPointer = zwp_pointer_constraints_v1_confine_pointer(