mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 19:12:04 +00:00
cursor-renderer: Disconnect the overlay cursor from the displayed cursor
The displayed cursor is the one displayed on the screen, e.g. via the hardware cursor plane, by Xorg, or using the stage overlay. When screen recording under X11, we don't get a stream of pointer and cursor updates, as they might be grabbed by some other client. Because of this, the cursor tracker or cursor renderer are not kept up to date with positional and cursor state. To be able to use the stage overlays when recording, we need to be able to update the overlay without updating the displayed cursor, as we shouldn't update the X server with cursor state we just retrieved from it. Thus, to achieve this, create a separate overlay cursor pointer. When being a display server, they are always the same, but when using X11, during screen recording, the overlay one will be polled at a fixed interval to get a somewhat up to date state. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
This commit is contained in:
parent
a10f35c613
commit
2d010c9b84
@ -58,6 +58,8 @@ struct _MetaCursorRendererPrivate
|
||||
float current_y;
|
||||
|
||||
MetaCursorSprite *displayed_cursor;
|
||||
MetaCursorSprite *overlay_cursor;
|
||||
|
||||
MetaOverlay *stage_overlay;
|
||||
gboolean handled_by_backend;
|
||||
gulong after_paint_handler_id;
|
||||
@ -123,15 +125,17 @@ align_cursor_position (MetaCursorRenderer *renderer,
|
||||
graphene_rect_offset (rect, view_layout.x, view_layout.y);
|
||||
}
|
||||
|
||||
static void
|
||||
update_stage_overlay (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite)
|
||||
void
|
||||
meta_cursor_renderer_update_stage_overlay (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite)
|
||||
{
|
||||
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
|
||||
ClutterActor *stage = meta_backend_get_stage (priv->backend);
|
||||
CoglTexture *texture;
|
||||
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
|
||||
|
||||
g_set_object (&priv->overlay_cursor, cursor_sprite);
|
||||
|
||||
if (cursor_sprite)
|
||||
{
|
||||
rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
|
||||
@ -239,6 +243,7 @@ meta_cursor_renderer_finalize (GObject *object)
|
||||
g_clear_signal_handler (&priv->after_paint_handler_id, stage);
|
||||
|
||||
g_clear_object (&priv->displayed_cursor);
|
||||
g_clear_object (&priv->overlay_cursor);
|
||||
|
||||
G_OBJECT_CLASS (meta_cursor_renderer_parent_class)->finalize (object);
|
||||
}
|
||||
@ -345,7 +350,7 @@ meta_cursor_renderer_update_cursor (MetaCursorRenderer *renderer,
|
||||
if (handled_by_backend != priv->handled_by_backend)
|
||||
priv->handled_by_backend = handled_by_backend;
|
||||
|
||||
update_stage_overlay (renderer, cursor_sprite);
|
||||
meta_cursor_renderer_update_stage_overlay (renderer, cursor_sprite);
|
||||
}
|
||||
|
||||
MetaCursorRenderer *
|
||||
@ -408,7 +413,7 @@ meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer)
|
||||
{
|
||||
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
|
||||
|
||||
return priv->displayed_cursor;
|
||||
return priv->overlay_cursor;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -84,4 +84,7 @@ graphene_rect_t meta_cursor_renderer_calculate_rect (MetaCursorRenderer *rendere
|
||||
void meta_cursor_renderer_emit_painted (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite);
|
||||
|
||||
void meta_cursor_renderer_update_stage_overlay (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite);
|
||||
|
||||
#endif /* META_CURSOR_RENDERER_H */
|
||||
|
Loading…
Reference in New Issue
Block a user