diff --git a/client/displayservers/X11/x11.c b/client/displayservers/X11/x11.c index 40f92c02..c1a5fee1 100644 --- a/client/displayservers/X11/x11.c +++ b/client/displayservers/X11/x11.c @@ -58,6 +58,7 @@ #define _NET_WM_STATE_TOGGLE 2 struct X11DSState x11; +struct LG_DisplayServerOps LGDS_X11; struct MwmHints { @@ -86,6 +87,7 @@ static int x11EventThread(void * unused); static void x11XInputEvent(XGenericEventCookie *cookie); static void x11XPresentEvent(XGenericEventCookie *cookie); static void x11GrabPointer(void); +static void x11NoSetPointer(LG_DSPointer pointer); static void x11DoPresent(uint64_t msc) { @@ -643,8 +645,12 @@ static bool x11Init(const LG_DSInitParams params) x11.cursors[i] = XcursorLibraryLoadCursor(x11.display, fallbackLookup[i]); } - /* default to the square cursor */ - XDefineCursor(x11.display, x11.window, x11.cursors[LG_POINTER_SQUARE]); + /* leave the mouse alone if the user requests it. */ + + if (params.hideMouse) + XDefineCursor(x11.display, x11.window, x11.cursors[LG_POINTER_SQUARE]); + else + LGDS_X11.setPointer = x11NoSetPointer; if (x11.jitRender) { @@ -1657,6 +1663,9 @@ static void x11SetPointer(LG_DSPointer pointer) XDefineCursor(x11.display, x11.window, x11.cursors[pointer]); } +static void x11NoSetPointer(LG_DSPointer pointer) +{} + static void x11PrintGrabError(const char * type, int dev, Status ret) { const char * errStr; diff --git a/client/include/interface/displayserver.h b/client/include/interface/displayserver.h index f63089d5..7b8750c6 100644 --- a/client/include/interface/displayserver.h +++ b/client/include/interface/displayserver.h @@ -97,6 +97,8 @@ typedef struct LG_DSInitParams // x11 needs to know if this is in use so we can decide to setup for // presentation times bool jitRender; + // x11 needs this early to not override the defaults. + bool hideMouse; } LG_DSInitParams; diff --git a/client/src/main.c b/client/src/main.c index b8b30160..1bc509d7 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1305,7 +1305,8 @@ static int lg_run(void) .borderless = g_params.borderless, .maximize = g_params.maximize, .opengl = needsOpenGL, - .jitRender = g_params.jitRender + .jitRender = g_params.jitRender, + .hideMouse = g_params.hideMouse }; g_state.dsInitialized = g_state.ds->init(params);