diff --git a/client/include/interface/displayserver.h b/client/include/interface/displayserver.h index 7146cc7d..62ae68f1 100644 --- a/client/include/interface/displayserver.h +++ b/client/include/interface/displayserver.h @@ -38,7 +38,19 @@ LG_ClipboardData; typedef enum LG_DSProperty { - LG_DS_MAX_MULTISAMPLE // data type is `int` + /** + * returns the maximum number of samples supported + * if not implemented LG assumes no multisample support + * return data type: int + */ + LG_DS_MAX_MULTISAMPLE, + + /** + * returns if the platform is warp capable + * if not implemented LG assumes that the platform is warp capable + * return data type: bool + */ + LG_DS_WARP_SUPPORT, } LG_DSProperty; @@ -64,7 +76,11 @@ struct LG_DisplayServerOps /* final free */ void (*free)(); - /* return a system specific property, returns false if unsupported or failure */ + /* + * return a system specific property, returns false if unsupported or failure + * if the platform does not support/implement the requested property the value + * of `ret` must not be altered. + */ bool (*getProp)(LG_DSProperty prop, void * ret); /* event filter, return true if the event has been handled */ diff --git a/client/src/main.c b/client/src/main.c index 300a88e5..43f68d17 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -915,6 +915,11 @@ static void setCursorInView(bool enable) if (enable && !g_state.focused) return; + /* if the display server does not support warp, then we can not operate in + * always relative mode and we should not grab the pointer */ + bool warpSupport = true; + app_getProp(LG_DS_WARP_SUPPORT, &warpSupport); + g_cursor.inView = enable; g_cursor.draw = params.alwaysShowCursor ? true : enable; g_cursor.redraw = true; @@ -926,14 +931,16 @@ static void setCursorInView(bool enable) if (params.hideMouse) SDL_ShowCursor(SDL_DISABLE); - g_state.ds->grabPointer(); + if (warpSupport) + g_state.ds->grabPointer(); } else { if (params.hideMouse) SDL_ShowCursor(SDL_ENABLE); - g_state.ds->ungrabPointer(); + if (warpSupport) + g_state.ds->ungrabPointer(); } }