From aed286aa462471a1cb0f91a4a45d0027a25ea7c2 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 29 Aug 2020 15:37:38 -0300 Subject: [PATCH] monitor-stream-src: Generalize function We'll need to pass a custom callback to the stage views watcher. Generalize and rename the add_view_painted_watches() function to allow accepting custom callbacks. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421 --- .../meta-screen-cast-monitor-stream-src.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c b/src/backends/meta-screen-cast-monitor-stream-src.c index 760fe7471..0f086cab9 100644 --- a/src/backends/meta-screen-cast-monitor-stream-src.c +++ b/src/backends/meta-screen-cast-monitor-stream-src.c @@ -277,8 +277,9 @@ uninhibit_hw_cursor (MetaScreenCastMonitorStreamSrc *monitor_src) } static void -add_view_painted_watches (MetaScreenCastMonitorStreamSrc *monitor_src, - MetaStageWatchPhase watch_phase) +add_view_watches (MetaScreenCastMonitorStreamSrc *monitor_src, + MetaStageWatchPhase watch_phase, + MetaStageWatchFunc callback) { MetaBackend *backend = get_backend (monitor_src); MetaRenderer *renderer = meta_backend_get_renderer (backend); @@ -308,7 +309,7 @@ add_view_painted_watches (MetaScreenCastMonitorStreamSrc *monitor_src, watch = meta_stage_watch_view (meta_stage, CLUTTER_STAGE_VIEW (view), watch_phase, - stage_painted, + callback, monitor_src); monitor_src->watches = g_list_prepend (monitor_src->watches, watch); @@ -343,14 +344,16 @@ meta_screen_cast_monitor_stream_src_enable (MetaScreenCastStreamSrc *src) meta_cursor_tracker_track_position (cursor_tracker); G_GNUC_FALLTHROUGH; case META_SCREEN_CAST_CURSOR_MODE_HIDDEN: - add_view_painted_watches (monitor_src, - META_STAGE_WATCH_AFTER_ACTOR_PAINT); + add_view_watches (monitor_src, + META_STAGE_WATCH_AFTER_ACTOR_PAINT, + stage_painted); break; case META_SCREEN_CAST_CURSOR_MODE_EMBEDDED: inhibit_hw_cursor (monitor_src); meta_cursor_tracker_track_position (cursor_tracker); - add_view_painted_watches (monitor_src, - META_STAGE_WATCH_AFTER_PAINT); + add_view_watches (monitor_src, + META_STAGE_WATCH_AFTER_PAINT, + stage_painted); break; }