Parcourir la source

Don't apply SDL_HINT_MOUSE_DPI_SCALE_CURSORS on Wayland

Wayland cursors are surfaces sized in scaled points, so this hint wouldn't change the size, just prevent larger backbuffers from being used to draw sharper scaled cursors.
Frank Praznik il y a 2 mois
Parent
commit
c2710bd4e8
1 fichiers modifiés avec 4 ajouts et 17 suppressions
  1. 4 17
      src/video/wayland/SDL_waylandmouse.c

+ 4 - 17
src/video/wayland/SDL_waylandmouse.c

@@ -1025,21 +1025,6 @@ typedef struct Wayland_PointerObject
     bool is_pointer;
     bool is_pointer;
 } Wayland_PointerObject;
 } Wayland_PointerObject;
 
 
-static float Wayland_GetCursorScale(SDL_WindowData *focus)
-{
-    SDL_VideoData *viddata = SDL_GetVideoDevice()->internal;
-
-    if (!SDL_GetHintBoolean(SDL_HINT_MOUSE_DPI_SCALE_CURSORS, false)) {
-        return 1.0f;
-    }
-
-    // If viewports aren't available, the scale is always 1.0.
-    if (viddata->viewporter && focus) {
-        return (float)focus->scale_factor;
-    }
-    return 1.0f;
-}
-
 static void Wayland_CursorStateSetCursor(SDL_WaylandCursorState *state, const Wayland_PointerObject *obj, SDL_WindowData *focus, Uint32 serial, SDL_Cursor *cursor)
 static void Wayland_CursorStateSetCursor(SDL_WaylandCursorState *state, const Wayland_PointerObject *obj, SDL_WindowData *focus, Uint32 serial, SDL_Cursor *cursor)
 {
 {
     SDL_VideoData *viddata = SDL_GetVideoDevice()->internal;
     SDL_VideoData *viddata = SDL_GetVideoDevice()->internal;
@@ -1094,14 +1079,16 @@ static void Wayland_CursorStateSetCursor(SDL_WaylandCursorState *state, const Wa
                 return;
                 return;
             }
             }
 
 
-            state->scale = Wayland_GetCursorScale(focus);
+            // If viewports aren't available, the scale is always 1.0.
+            state->scale = viddata->viewporter && focus ? focus->scale_factor : 1.0;
             if (!Wayland_GetSystemCursor(cursor_data, state, &dst_width, &hot_x, &hot_y)) {
             if (!Wayland_GetSystemCursor(cursor_data, state, &dst_width, &hot_x, &hot_y)) {
                 return;
                 return;
             }
             }
 
 
             dst_height = dst_width;
             dst_height = dst_width;
         } else {
         } else {
-            state->scale = Wayland_GetCursorScale(focus);
+            // If viewports aren't available, the scale is always 1.0.
+            state->scale = viddata->viewporter && focus ? focus->scale_factor : 1.0;
             dst_width = cursor_data->cursor_data.custom.width;
             dst_width = cursor_data->cursor_data.custom.width;
             dst_height = cursor_data->cursor_data.custom.height;
             dst_height = cursor_data->cursor_data.custom.height;
             hot_x = cursor_data->cursor_data.custom.hot_x;
             hot_x = cursor_data->cursor_data.custom.hot_x;