diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c index 08a441d24..512eda1fc 100644 --- a/src/backends/meta-remote-desktop-session.c +++ b/src/backends/meta-remote-desktop-session.c @@ -321,12 +321,34 @@ ensure_virtual_device (MetaRemoteDesktopSession *session, *virtual_device_ptr = clutter_seat_create_virtual_device (seat, device_type); } +static void +on_stream_is_configured (MetaScreenCastStream *stream, + GParamSpec *pspec, + MetaRemoteDesktopSession *session) +{ + g_signal_handlers_disconnect_by_func (stream, + on_stream_is_configured, + session); + + g_return_if_fail (meta_screen_cast_stream_is_configured (stream)); + + meta_eis_add_viewport (session->eis, META_EIS_VIEWPORT (stream)); +} + static void on_stream_added (MetaScreenCastSession *screen_cast_session, MetaScreenCastStream *stream, MetaRemoteDesktopSession *session) { - meta_eis_add_viewport (session->eis, META_EIS_VIEWPORT (stream)); + if (meta_screen_cast_stream_is_configured (stream)) + { + meta_eis_add_viewport (session->eis, META_EIS_VIEWPORT (stream)); + } + else + { + g_signal_connect (stream, "notify::is-configured", + G_CALLBACK (on_stream_is_configured), session); + } } static void @@ -334,7 +356,10 @@ on_stream_removed (MetaScreenCastSession *screen_cast_session, MetaScreenCastStream *stream, MetaRemoteDesktopSession *session) { - meta_eis_remove_viewport (session->eis, META_EIS_VIEWPORT (stream)); + if (g_signal_handlers_disconnect_by_func (stream, + on_stream_is_configured, + session) == 0) + meta_eis_remove_viewport (session->eis, META_EIS_VIEWPORT (stream)); } static void