screen-cast/area-src: Handle monitors changes here too

Like with the monitor source, we need to reattach to the new views after
monitor changes, otherwise the screen cast will get stuck.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1691>
This commit is contained in:
Jonas Ådahl 2021-01-28 23:21:12 +01:00 committed by Marge Bot
parent e877b06fdd
commit 893c0cd2f9

View File

@ -303,12 +303,29 @@ add_view_painted_watches (MetaScreenCastAreaStreamSrc *area_src,
}
}
static void
on_monitors_changed (MetaMonitorManager *monitor_manager,
MetaScreenCastAreaStreamSrc *area_src)
{
MetaStage *stage = META_STAGE (get_stage (area_src));
GList *l;
for (l = area_src->watches; l; l = l->next)
meta_stage_remove_watch (stage, l->data);
g_clear_pointer (&area_src->watches, g_list_free);
add_view_painted_watches (area_src,
META_STAGE_WATCH_AFTER_ACTOR_PAINT);
}
static void
meta_screen_cast_area_stream_src_enable (MetaScreenCastStreamSrc *src)
{
MetaScreenCastAreaStreamSrc *area_src =
META_SCREEN_CAST_AREA_STREAM_SRC (src);
MetaBackend *backend = get_backend (area_src);
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
ClutterStage *stage;
MetaScreenCastStream *stream;
@ -341,6 +358,10 @@ meta_screen_cast_area_stream_src_enable (MetaScreenCastStreamSrc *src)
break;
}
g_signal_connect_object (monitor_manager, "monitors-changed-internal",
G_CALLBACK (on_monitors_changed),
area_src, 0);
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
}