[mutter/gbsneto/more-screencast: 19/19] stream: Remove cursor if it's invisible




commit a00ab5fadaba77f3d9f8a71eed204feef61553ec
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Sep 1 10:25:02 2020 -0300

    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

 src/backends/meta-screen-cast-area-stream-src.c    | 5 ++++-
 src/backends/meta-screen-cast-monitor-stream-src.c | 5 ++++-
 src/backends/meta-screen-cast-window-stream-src.c  | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/meta-screen-cast-area-stream-src.c b/src/backends/meta-screen-cast-area-stream-src.c
index 5846177537..e22b7dcabf 100644
--- a/src/backends/meta-screen-cast-area-stream-src.c
+++ b/src/backends/meta-screen-cast-area-stream-src.c
@@ -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);
diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c 
b/src/backends/meta-screen-cast-monitor-stream-src.c
index b0b3b3763e..2a22dc5359 100644
--- a/src/backends/meta-screen-cast-monitor-stream-src.c
+++ b/src/backends/meta-screen-cast-monitor-stream-src.c
@@ -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);
diff --git a/src/backends/meta-screen-cast-window-stream-src.c 
b/src/backends/meta-screen-cast-window-stream-src.c
index 3f7cb356d2..a00bf867ab 100644
--- a/src/backends/meta-screen-cast-window-stream-src.c
+++ b/src/backends/meta-screen-cast-window-stream-src.c
@@ -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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]