stream: Remove cursor if it's invisible

The cursor tracker may give us a valid position, and a
valid cursor sprite, and yet the cursor can be hidden,
meaning we must hide the cursor on the stream as well.

Remove cursor from stream buffer if it's hidden.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
This commit is contained in:
Georges Basile Stavracas Neto 2020-09-01 10:25:02 -03:00
parent 25939986ec
commit a00ab5fada
3 changed files with 12 additions and 3 deletions

View File

@ -505,6 +505,8 @@ meta_screen_cast_area_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *s
MetaBackend *backend = get_backend (area_src);
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
MetaCursorTracker *cursor_tracker =
meta_backend_get_cursor_tracker (backend);
MetaCursorSprite *cursor_sprite;
MetaRectangle *area;
float scale;
@ -513,7 +515,8 @@ meta_screen_cast_area_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *s
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);
if (!is_cursor_in_stream (area_src))
if (!meta_cursor_tracker_get_pointer_visible (cursor_tracker) ||
!is_cursor_in_stream (area_src))
{
meta_screen_cast_stream_src_unset_cursor_metadata (src,
spa_meta_cursor);

View File

@ -632,6 +632,8 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
MetaBackend *backend = get_backend (monitor_src);
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
MetaCursorTracker *cursor_tracker =
meta_backend_get_cursor_tracker (backend);
MetaCursorSprite *cursor_sprite;
MetaMonitor *monitor;
MetaLogicalMonitor *logical_monitor;
@ -643,7 +645,8 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);
if (!is_cursor_in_stream (monitor_src))
if (!meta_cursor_tracker_get_pointer_visible (cursor_tracker) ||
!is_cursor_in_stream (monitor_src))
{
meta_screen_cast_stream_src_unset_cursor_metadata (src,
spa_meta_cursor);

View File

@ -516,6 +516,8 @@ meta_screen_cast_window_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
MetaBackend *backend = get_backend (window_src);
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
MetaCursorTracker *cursor_tracker =
meta_backend_get_cursor_tracker (backend);
MetaScreenCastWindow *screen_cast_window = window_src->screen_cast_window;
MetaCursorSprite *cursor_sprite;
graphene_point_t cursor_position;
@ -526,7 +528,8 @@ meta_screen_cast_window_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
if (!meta_screen_cast_window_transform_cursor_position (screen_cast_window,
if (!meta_cursor_tracker_get_pointer_visible (cursor_tracker) ||
!meta_screen_cast_window_transform_cursor_position (screen_cast_window,
cursor_sprite,
&cursor_position,
&scale,