[client] wayland: add option to enable cursor warp

This is enabled on default. Specify wayland:warpSupport=no to disable it,
which may be useful on certain compositors that do not warp when the
pointer is confined.
This commit is contained in:
Quantum
2021-02-15 20:54:02 -05:00
committed by Geoffrey McRae
parent 9b688909b0
commit 1ba1108099
6 changed files with 44 additions and 0 deletions

View File

@@ -42,6 +42,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "common/debug.h"
#include "common/locking.h"
#include "common/countedbuffer.h"
#include "common/option.h"
#include "wayland-xdg-shell-client-protocol.h"
#include "wayland-xdg-decoration-unstable-v1-client-protocol.h"
@@ -166,6 +167,18 @@ struct WCBState
static struct WaylandDSState wm;
static struct WCBState wcb;
static struct Option waylandOptions[] =
{
{
.module = "wayland",
.name = "warpSupport",
.description = "Enable cursor warping",
.type = OPTION_TYPE_BOOL,
.value.x_bool = true,
},
{0}
};
static const uint32_t cursorBitmap[] = {
0x000000, 0x000000, 0x000000, 0x000000,
0x000000, 0xFFFFFF, 0xFFFFFF, 0x000000,
@@ -618,6 +631,11 @@ static bool waylandEarlyInit(void)
return true;
}
static void waylandSetup(void)
{
option_register(waylandOptions);
}
static bool waylandProbe(void)
{
return getenv("WAYLAND_DISPLAY") != NULL;
@@ -630,6 +648,8 @@ static bool waylandInit(const LG_DSInitParams params)
{
memset(&wm, 0, sizeof(wm));
wm.warpSupport = option_get_bool("wayland", "warpSupport");
wm.epollFd = epoll_create1(EPOLL_CLOEXEC);
if (wm.epollFd < 0)
{
@@ -1514,6 +1534,7 @@ static void waylandCBRelease(void)
struct LG_DisplayServerOps LGDS_Wayland =
{
.setup = waylandSetup,
.probe = waylandProbe,
.earlyInit = waylandEarlyInit,
.init = waylandInit,