virtual-stream: Paint stage properly with/without cursor
This change ensures that when the painted stage is written out to the buffer, it respects the clients desire to either desire to either embed the cursor in the view or not. Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2142 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2629>
This commit is contained in:
parent
abc8555463
commit
986d3be7ac
@ -355,11 +355,38 @@ meta_screen_cast_virtual_stream_src_record_to_buffer (MetaScreenCastStreamSrc *
|
||||
uint8_t *data,
|
||||
GError **error)
|
||||
{
|
||||
clutter_stage_capture_view_into (stage_from_src (src),
|
||||
view_from_src (src),
|
||||
NULL,
|
||||
data,
|
||||
stride);
|
||||
MetaScreenCastStream *stream;
|
||||
ClutterPaintFlag paint_flags;
|
||||
ClutterStageView *view;
|
||||
MetaRectangle view_rect;
|
||||
float scale;
|
||||
|
||||
stream = meta_screen_cast_stream_src_get_stream (src);
|
||||
view = view_from_src (src);
|
||||
scale = clutter_stage_view_get_scale (view);
|
||||
clutter_stage_view_get_layout (view, &view_rect);
|
||||
|
||||
paint_flags = CLUTTER_PAINT_FLAG_CLEAR;
|
||||
switch (meta_screen_cast_stream_get_cursor_mode (stream))
|
||||
{
|
||||
case META_SCREEN_CAST_CURSOR_MODE_METADATA:
|
||||
case META_SCREEN_CAST_CURSOR_MODE_HIDDEN:
|
||||
paint_flags |= CLUTTER_PAINT_FLAG_NO_CURSORS;
|
||||
break;
|
||||
case META_SCREEN_CAST_CURSOR_MODE_EMBEDDED:
|
||||
paint_flags |= CLUTTER_PAINT_FLAG_FORCE_CURSORS;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!clutter_stage_paint_to_buffer (stage_from_src (src),
|
||||
&view_rect,
|
||||
scale,
|
||||
data,
|
||||
stride,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
paint_flags,
|
||||
error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user