wayland: Don't take & drop sprite reference in _update_cursor_surface

It's now pointless busy-work, since these functions never own the sprite
object anymore.

Suggested by Sebastian Wick.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4371>
This commit is contained in:
Michel Dänzer 2025-03-28 16:31:56 +01:00 committed by Bruce Leidl
parent d6f3f4f089
commit ca7d7fc53f
2 changed files with 7 additions and 14 deletions

View File

@ -1153,16 +1153,14 @@ meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer)
if (surface) if (surface)
{ {
g_autoptr (MetaCursorSprite) cursor_sprite = NULL; MetaCursorSprite *cursor_sprite = NULL;
if (pointer->cursor_surface) if (pointer->cursor_surface)
{ {
MetaWaylandCursorSurface *cursor_surface = MetaWaylandCursorSurface *cursor_surface =
META_WAYLAND_CURSOR_SURFACE (pointer->cursor_surface->role); META_WAYLAND_CURSOR_SURFACE (pointer->cursor_surface->role);
MetaCursorSprite *sprite;
sprite = meta_wayland_cursor_surface_get_sprite (cursor_surface); cursor_sprite = meta_wayland_cursor_surface_get_sprite (cursor_surface);
cursor_sprite = g_object_ref (sprite);
} }
else if (pointer->cursor_shape != META_CURSOR_INVALID) else if (pointer->cursor_shape != META_CURSOR_INVALID)
{ {
@ -1173,7 +1171,7 @@ meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer)
cursor_tracker); cursor_tracker);
} }
cursor_sprite = g_object_ref (META_CURSOR_SPRITE (pointer->shape_sprite)); cursor_sprite = META_CURSOR_SPRITE (pointer->shape_sprite);
} }
meta_cursor_tracker_set_window_cursor (cursor_tracker, cursor_sprite); meta_cursor_tracker_set_window_cursor (cursor_tracker, cursor_sprite);

View File

@ -120,7 +120,7 @@ meta_wayland_tablet_tool_update_cursor_surface (MetaWaylandTabletTool *tool)
MetaBackend *backend = backend_from_tool (tool); MetaBackend *backend = backend_from_tool (tool);
MetaCursorTracker *cursor_tracker = MetaCursorTracker *cursor_tracker =
meta_backend_get_cursor_tracker (backend); meta_backend_get_cursor_tracker (backend);
g_autoptr (MetaCursorSprite) cursor_sprite = NULL; MetaCursorSprite *cursor_sprite = NULL;
if (tool->cursor_renderer == NULL) if (tool->cursor_renderer == NULL)
return; return;
@ -132,10 +132,8 @@ meta_wayland_tablet_tool_update_cursor_surface (MetaWaylandTabletTool *tool)
{ {
MetaWaylandCursorSurface *cursor_surface = MetaWaylandCursorSurface *cursor_surface =
META_WAYLAND_CURSOR_SURFACE (tool->cursor_surface->role); META_WAYLAND_CURSOR_SURFACE (tool->cursor_surface->role);
MetaCursorSprite *sprite;
sprite = meta_wayland_cursor_surface_get_sprite (cursor_surface); cursor_sprite = meta_wayland_cursor_surface_get_sprite (cursor_surface);
cursor_sprite = g_object_ref (sprite);
} }
else if (tool->cursor_shape != META_CURSOR_INVALID) else if (tool->cursor_shape != META_CURSOR_INVALID)
{ {
@ -146,15 +144,12 @@ meta_wayland_tablet_tool_update_cursor_surface (MetaWaylandTabletTool *tool)
cursor_tracker); cursor_tracker);
} }
cursor_sprite = g_object_ref (META_CURSOR_SPRITE (tool->shape_sprite)); cursor_sprite = META_CURSOR_SPRITE (tool->shape_sprite);
} }
} }
else if (tool->current_tablet) else if (tool->current_tablet)
{ {
MetaCursorSprite *sprite; cursor_sprite = META_CURSOR_SPRITE (tool->default_sprite);
sprite = META_CURSOR_SPRITE (tool->default_sprite);
cursor_sprite = g_object_ref (sprite);
} }
meta_cursor_renderer_set_cursor (tool->cursor_renderer, cursor_sprite); meta_cursor_renderer_set_cursor (tool->cursor_renderer, cursor_sprite);