[mutter/wip/carlosg/input-thread: 74/76] backends: Make pointer cursor invisible until the stage is shown




commit 6ee2aa73ecb0ac2e60ba2c68a6a396dc5cf359a9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 28 19:41:40 2020 +0100

    backends: Make pointer cursor invisible until the stage is shown
    
    We are able to show the cursor before that, it doesn't mean we should.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403

 src/backends/meta-backend.c        | 11 +++++++++++
 src/backends/meta-cursor-tracker.c |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index ba964c58b7..54e2da2e30 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -574,6 +574,14 @@ input_mapper_device_aspect_ratio_cb (MetaInputMapper    *mapper,
   meta_input_settings_set_device_aspect_ratio (input_settings, device, aspect_ratio);
 }
 
+static void
+on_stage_shown_cb (MetaBackend *backend)
+{
+  MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
+
+  meta_cursor_tracker_set_pointer_visible (priv->cursor_tracker, TRUE);
+}
+
 static void
 meta_backend_real_post_init (MetaBackend *backend)
 {
@@ -584,6 +592,9 @@ meta_backend_real_post_init (MetaBackend *backend)
   priv->stage = meta_stage_new (backend);
   clutter_actor_realize (priv->stage);
   META_BACKEND_GET_CLASS (backend)->select_stage_events (backend);
+  g_signal_connect_object (priv->stage, "show",
+                           G_CALLBACK (on_stage_shown_cb), backend,
+                           G_CONNECT_SWAPPED);
 
   meta_monitor_manager_setup (priv->monitor_manager);
 
diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c
index 6b3d2289ad..d2bd22606a 100644
--- a/src/backends/meta-cursor-tracker.c
+++ b/src/backends/meta-cursor-tracker.c
@@ -196,7 +196,7 @@ meta_cursor_tracker_init (MetaCursorTracker *tracker)
   MetaCursorTrackerPrivate *priv =
     meta_cursor_tracker_get_instance_private (tracker);
 
-  priv->is_showing = TRUE;
+  priv->is_showing = FALSE;
   priv->x = -1.0;
   priv->y = -1.0;
 }


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