[client] ds: separate grab and capture logic

Currently, (un)grabPointer is used both for tracking/confining the mouse
in normal mode, as well as entering/exiting capture mode. This makes it
impossible to use separate cursor logic for capture mode, which is needed
to deal with overlapping windows for the Wayland backend.

This commit creates separate (un)capturePointer for entering/exiting
capture mode. There should be no behaviour changes.
This commit is contained in:
Quantum
2021-05-03 20:16:51 -04:00
committed by Geoffrey McRae
parent 7acbc57bc7
commit 00c2773e6b
9 changed files with 65 additions and 14 deletions

View File

@@ -357,6 +357,24 @@ void waylandUngrabPointer(void)
}
}
void waylandCapturePointer(void)
{
waylandGrabPointer();
}
void waylandUncapturePointer(void)
{
/* we need to ungrab the pointer on the following conditions when exiting capture mode:
* - if warp is not supported, exit via window edge detection will never work
* as the cursor can not be warped out of the window when we release it.
* - if the format is invalid as we do not know where the guest cursor is,
* which also breaks edge detection.
* - if the user has opted to use captureInputOnly mode.
*/
if (!wlWm.warpSupport || !app_isFormatValid() || app_isCaptureOnlyMode())
waylandUngrabPointer();
}
void waylandGrabKeyboard(void)
{
if (wlWm.keyboardInhibitManager && !wlWm.keyboardInhibitor)