From 1a1a16324b8beb9502482c716cdfb73ffdde45e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 4 Sep 2023 11:46:43 +0200 Subject: [PATCH] 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: --- src/backends/meta-remote-desktop-session.c | 29 ++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) 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