From 5d35138df02f522ea517481b3cbb5db6d943d6fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 21 Dec 2022 18:28:35 +0100 Subject: [PATCH] cursor-renderer: Make 'handled_by_backend' state 'needs_overlay' This will, conceptually, and eventually, allow a backend to both want an overlay, while still handling it by default. Part-of: --- src/backends/meta-cursor-renderer.c | 8 ++++---- src/backends/native/meta-cursor-renderer-native.c | 6 +++--- src/backends/x11/meta-cursor-renderer-x11.c | 4 ++-- src/backends/x11/nested/meta-cursor-renderer-x11-nested.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/backends/meta-cursor-renderer.c b/src/backends/meta-cursor-renderer.c index e85298522..a1abd4006 100644 --- a/src/backends/meta-cursor-renderer.c +++ b/src/backends/meta-cursor-renderer.c @@ -65,7 +65,7 @@ struct _MetaCursorRendererPrivate MetaCursorSprite *overlay_cursor; MetaOverlay *stage_overlay; - gboolean handled_by_backend; + gboolean needs_overlay; gulong after_paint_handler_id; GList *hw_cursor_inhibitors; @@ -157,7 +157,7 @@ meta_cursor_renderer_update_stage_overlay (MetaCursorRenderer *renderer, meta_cursor_sprite_get_texture_transform (cursor_sprite); } - meta_overlay_set_visible (priv->stage_overlay, !priv->handled_by_backend); + meta_overlay_set_visible (priv->stage_overlay, priv->needs_overlay); meta_stage_update_cursor_overlay (META_STAGE (stage), priv->stage_overlay, texture, &rect, buffer_transform); } @@ -171,7 +171,7 @@ meta_cursor_renderer_after_paint (ClutterStage *stage, MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer); - if (priv->displayed_cursor && !priv->handled_by_backend) + if (priv->displayed_cursor && priv->needs_overlay) { graphene_rect_t rect; MetaRectangle view_layout; @@ -411,7 +411,7 @@ meta_cursor_renderer_update_cursor (MetaCursorRenderer *renderer, (int) priv->current_y); } - priv->handled_by_backend = + priv->needs_overlay = META_CURSOR_RENDERER_GET_CLASS (renderer)->update_cursor (renderer, cursor_sprite); diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c index b8cba20b3..954678ae8 100644 --- a/src/backends/native/meta-cursor-renderer-native.c +++ b/src/backends/native/meta-cursor-renderer-native.c @@ -1113,9 +1113,9 @@ meta_cursor_renderer_native_update_cursor (MetaCursorRenderer *renderer, schedule_sync_position (native); clutter_stage_schedule_update (stage); - return (priv->has_hw_cursor || - !cursor_sprite || - !meta_cursor_sprite_get_cogl_texture (cursor_sprite)); + return !(priv->has_hw_cursor || + !cursor_sprite || + !meta_cursor_sprite_get_cogl_texture (cursor_sprite)); } static void diff --git a/src/backends/x11/meta-cursor-renderer-x11.c b/src/backends/x11/meta-cursor-renderer-x11.c index 5a7e771b9..997f9f1b4 100644 --- a/src/backends/x11/meta-cursor-renderer-x11.c +++ b/src/backends/x11/meta-cursor-renderer-x11.c @@ -55,7 +55,7 @@ meta_cursor_renderer_x11_update_cursor (MetaCursorRenderer *renderer, { if (cursor_sprite) meta_cursor_sprite_realize_texture (cursor_sprite); - return FALSE; + return TRUE; } gboolean has_server_cursor = FALSE; @@ -93,7 +93,7 @@ meta_cursor_renderer_x11_update_cursor (MetaCursorRenderer *renderer, if (cursor_sprite) meta_cursor_sprite_realize_texture (cursor_sprite); - return priv->server_cursor_visible; + return !priv->server_cursor_visible; } static void diff --git a/src/backends/x11/nested/meta-cursor-renderer-x11-nested.c b/src/backends/x11/nested/meta-cursor-renderer-x11-nested.c index 993ddcae4..b0614a50b 100644 --- a/src/backends/x11/nested/meta-cursor-renderer-x11-nested.c +++ b/src/backends/x11/nested/meta-cursor-renderer-x11-nested.c @@ -44,7 +44,7 @@ meta_cursor_renderer_x11_nested_update_cursor (MetaCursorRenderer *renderer, { if (cursor_sprite) meta_cursor_sprite_realize_texture (cursor_sprite); - return FALSE; + return TRUE; } static Cursor