From ef21f2307e3ecb64e98c55cb6141a862999f0f06 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Mon, 3 Mar 2025 16:43:57 +0100 Subject: [PATCH] cursor-renderer/native: Invalidate state for output color state changes When the output color state changes, we have to re-create the color state transform. This is especially noticable when the luminance is adjusted and the cursor is not affected. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3935 Fixes: a72ee3be0d ("cursor-renderer/native: Transform cursor sprite into output color state") Part-of: --- .../native/meta-cursor-renderer-native.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c index f170cf21e..6949bd7b0 100644 --- a/src/backends/native/meta-cursor-renderer-native.c +++ b/src/backends/native/meta-cursor-renderer-native.c @@ -139,6 +139,19 @@ get_cursor_stage_view (MetaStageView *view) quark_cursor_stage_view); } +static void +on_output_color_state_changed (MetaStageView *view, + gpointer user_data) +{ + CursorStageView *cursor_stage_view; + + cursor_stage_view = get_cursor_stage_view (view); + if (!cursor_stage_view) + return; + + cursor_stage_view->is_hw_cursor_valid = FALSE; +} + static CursorStageView * ensure_cursor_stage_view (MetaStageView *view) { @@ -149,6 +162,12 @@ ensure_cursor_stage_view (MetaStageView *view) { cursor_stage_view = g_new0 (CursorStageView, 1); cursor_stage_view->is_hw_cursor_valid = FALSE; + + g_signal_connect (G_OBJECT (view), + "notify::output-color-state", + G_CALLBACK (on_output_color_state_changed), + NULL); + g_object_set_qdata_full (G_OBJECT (view), quark_cursor_stage_view, cursor_stage_view,