[mutter] cursor-tracker: Add meta_cursor_tracker_get_scale ()



commit f6bf1ceb925000fd0f169bb6fe558be374f84fca
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Wed Aug 4 15:42:45 2021 +0300

    cursor-tracker: Add meta_cursor_tracker_get_scale ()
    
    Used in the screenshot UI (and arguably should be used in the existing
    gnome-shell screenshot drawing code).
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1967>

 src/backends/meta-cursor-tracker.c | 19 +++++++++++++++++++
 src/meta/meta-cursor-tracker.h     |  3 +++
 2 files changed, 22 insertions(+)
---
diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c
index 24776e266f..0df4d73cd4 100644
--- a/src/backends/meta-cursor-tracker.c
+++ b/src/backends/meta-cursor-tracker.c
@@ -362,6 +362,25 @@ meta_cursor_tracker_get_sprite (MetaCursorTracker *tracker)
   return meta_cursor_sprite_get_cogl_texture (cursor_sprite);
 }
 
+/**
+ * meta_cursor_tracker_get_scale:
+ * @tracker:
+ *
+ * Returns:
+ */
+float
+meta_cursor_tracker_get_scale (MetaCursorTracker *tracker)
+{
+  MetaCursorSprite *cursor_sprite;
+
+  cursor_sprite = META_CURSOR_TRACKER_GET_CLASS (tracker)->get_sprite (tracker);
+
+  if (!cursor_sprite)
+    return 1.0;
+
+  return meta_cursor_sprite_get_texture_scale (cursor_sprite);
+}
+
 /**
  * meta_cursor_tracker_get_hot:
  * @tracker:
diff --git a/src/meta/meta-cursor-tracker.h b/src/meta/meta-cursor-tracker.h
index a3b71c4f6a..fb4750c668 100644
--- a/src/meta/meta-cursor-tracker.h
+++ b/src/meta/meta-cursor-tracker.h
@@ -48,6 +48,9 @@ void           meta_cursor_tracker_get_hot    (MetaCursorTracker *tracker,
 META_EXPORT
 CoglTexture   *meta_cursor_tracker_get_sprite (MetaCursorTracker *tracker);
 
+META_EXPORT
+float          meta_cursor_tracker_get_scale (MetaCursorTracker *tracker);
+
 META_EXPORT
 void           meta_cursor_tracker_get_pointer (MetaCursorTracker   *tracker,
                                                 graphene_point_t    *coords,


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