remote-desktop/virtual: Drop absolute events if not active

If the remote desktop service emits absolute input events (e.g. absolute
pointer events) before the stream has started streaming, we don't have a
virtual monitor, as the size has not been negotiated yet. When this
happens, just drop the event. Remote desktop services should probably
make sure not to send events before the streaming has started, but them
doing so anyway shouldn't trigger a crash, which would be the case
otherwise.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
This commit is contained in:
Jonas Ådahl 2022-03-02 11:24:40 +01:00 committed by Marge Bot
parent d649445bb7
commit 1e50ca0057
3 changed files with 6 additions and 1 deletions

View File

@ -678,7 +678,7 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
pw_stream_queue_buffer (priv->pipewire_stream, buffer); pw_stream_queue_buffer (priv->pipewire_stream, buffer);
} }
static gboolean gboolean
meta_screen_cast_stream_src_is_enabled (MetaScreenCastStreamSrc *src) meta_screen_cast_stream_src_is_enabled (MetaScreenCastStreamSrc *src)
{ {
MetaScreenCastStreamSrcPrivate *priv = MetaScreenCastStreamSrcPrivate *priv =

View File

@ -82,6 +82,8 @@ struct _MetaScreenCastStreamSrcClass
void meta_screen_cast_stream_src_close (MetaScreenCastStreamSrc *src); void meta_screen_cast_stream_src_close (MetaScreenCastStreamSrc *src);
gboolean meta_screen_cast_stream_src_is_enabled (MetaScreenCastStreamSrc *src);
void meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src, void meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
MetaScreenCastRecordFlag flags); MetaScreenCastRecordFlag flags);

View File

@ -93,6 +93,9 @@ meta_screen_cast_virtual_stream_transform_position (MetaScreenCastStream *stream
ClutterStageView *view; ClutterStageView *view;
MetaRectangle view_layout; MetaRectangle view_layout;
if (!meta_screen_cast_stream_src_is_enabled (src))
return FALSE;
view = meta_screen_cast_virtual_stream_src_get_view (virtual_src); view = meta_screen_cast_virtual_stream_src_get_view (virtual_src);
if (!view) if (!view)
return FALSE; return FALSE;