[mutter] renderer: Add API to get view from logical monitor



commit bd97b11414467166b1dffcd82dd4b15b5fc1abe2
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Dec 12 11:37:13 2018 +0100

    renderer: Add API to get view from logical monitor
    
    Will be used to get the view scale for a logical monitor, which is
    necessary for passing cursor sprites via PipeWire.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/357

 src/backends/meta-renderer.c | 18 ++++++++++++++++++
 src/backends/meta-renderer.h |  3 +++
 2 files changed, 21 insertions(+)
---
diff --git a/src/backends/meta-renderer.c b/src/backends/meta-renderer.c
index 85d3984ed..28637437b 100644
--- a/src/backends/meta-renderer.c
+++ b/src/backends/meta-renderer.c
@@ -142,6 +142,24 @@ meta_renderer_get_views (MetaRenderer *renderer)
   return priv->views;
 }
 
+MetaRendererView *
+meta_renderer_get_view_from_logical_monitor (MetaRenderer       *renderer,
+                                             MetaLogicalMonitor *logical_monitor)
+{
+  GList *l;
+
+  for (l = meta_renderer_get_views (renderer); l; l = l->next)
+    {
+      MetaRendererView *view = l->data;
+
+      if (meta_renderer_view_get_logical_monitor (view) ==
+          logical_monitor)
+        return view;
+    }
+
+  return NULL;
+}
+
 static void
 meta_renderer_finalize (GObject *object)
 {
diff --git a/src/backends/meta-renderer.h b/src/backends/meta-renderer.h
index ba91a2584..b6df4f177 100644
--- a/src/backends/meta-renderer.h
+++ b/src/backends/meta-renderer.h
@@ -53,4 +53,7 @@ void meta_renderer_set_legacy_view (MetaRenderer     *renderer,
 
 GList * meta_renderer_get_views (MetaRenderer *renderer);
 
+MetaRendererView * meta_renderer_get_view_from_logical_monitor (MetaRenderer       *renderer,
+                                                                MetaLogicalMonitor *logical_monitor);
+
 #endif /* META_RENDERER_H */


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