From d2094bd0a248d03384b9fe01b09456cb6f063272 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Sat, 28 Sep 2024 12:18:58 -0400
Subject: [PATCH] wayland: Don't query the cursor info with DBus if the cursor
shape protocol is present
If the cursor shape protocol is supported, the compositor will handle cursor themes and sizes automatically, so querying the properties with DBus serves no purpose as the values are never used.
---
src/video/wayland/SDL_waylandmouse.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index f503e2de290ea..6e9b0122b7b24 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -578,7 +578,7 @@ static SDL_Cursor *Wayland_CreateSystemCursor(SDL_SystemCursor id)
/* The surface is only necessary if the cursor shape manager is not present.
*
* Note that we can't actually set any other cursor properties, as this
- * is output-specific. See wayland_get_system_cursor for the rest!
+ * is window-specific. See Wayland_GetSystemCursor for the rest!
*/
if (!data->cursor_shape_manager) {
cdata->surface = wl_compositor_create_surface(data->compositor);
@@ -1013,7 +1013,12 @@ void Wayland_InitMouse(void)
}
#ifdef SDL_USE_LIBDBUS
- Wayland_DBusInitCursorProperties(d);
+ /* The DBus cursor properties are only needed when manually loading themes and cursors.
+ * If the cursor shape protocol is present, the compositor will handle it internally.
+ */
+ if (!d->cursor_shape_manager) {
+ Wayland_DBusInitCursorProperties(d);
+ }
#endif
SDL_SetDefaultCursor(Wayland_CreateDefaultCursor());