backends/native: Fix accounting of cursor overlay inhibition

We react on changes to has_hw_cursor, but always try to inhibit if
there is no cursor sprite. While this looks like a reasonable optimization
with the typical situation of one cursor renderer, it may fall into
inhibiting twice without knowing to unwind, e.g.:

1. has_hw_cursor: TRUE, cursor_sprite: !=NULL -> inhibit
2. has_hw_cursor: FALSE, cursor_sprite: NULL -> inhibit
3. has_hw_cursor: TRUE, cursor_sprite: !=NULL -> uninhibit, but once

And this may also result in the CLUTTER_PAINT_FLAG_NO_CURSORS flag
staying on for Tablet cursors, that (so far) always use overlay paths.
This results in invisible tablet cursors after using the mouse at
least once.

Fixes: e52641c4b6 ("cursor-renderer/native: Replace HW cursor with KMS cursor manager")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3218>
This commit is contained in:
Carlos Garnacho 2023-08-28 16:06:51 +02:00 committed by Marge Bot
parent 630f13db78
commit d24be90941

View File

@ -368,7 +368,7 @@ meta_cursor_renderer_native_update_cursor (MetaCursorRenderer *cursor_renderer,
if (cursor_stage_view->has_hw_cursor != has_hw_cursor) if (cursor_stage_view->has_hw_cursor != has_hw_cursor)
{ {
if (has_hw_cursor || !cursor_sprite) if (has_hw_cursor)
meta_stage_view_inhibit_cursor_overlay (view); meta_stage_view_inhibit_cursor_overlay (view);
else else
meta_stage_view_uninhibit_cursor_overlay (view); meta_stage_view_uninhibit_cursor_overlay (view);