remote-desktop/session: Only add configured streams as viewports

This means they will have a valid size/position. This makes absolute
pointer events work on virtual monitor streams again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3241>
This commit is contained in:
Jonas Ådahl 2023-09-04 11:46:43 +02:00
parent 264d29b435
commit 1a1a16324b

View File

@ -321,12 +321,34 @@ ensure_virtual_device (MetaRemoteDesktopSession *session,
*virtual_device_ptr = clutter_seat_create_virtual_device (seat, device_type); *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 static void
on_stream_added (MetaScreenCastSession *screen_cast_session, on_stream_added (MetaScreenCastSession *screen_cast_session,
MetaScreenCastStream *stream, MetaScreenCastStream *stream,
MetaRemoteDesktopSession *session) 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 static void
@ -334,7 +356,10 @@ on_stream_removed (MetaScreenCastSession *screen_cast_session,
MetaScreenCastStream *stream, MetaScreenCastStream *stream,
MetaRemoteDesktopSession *session) 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 static void