[mutter/wip/carlosg/no-scaled-views-check-in-thread: 22/23] backends: Store whether views are scaled in MetaViewportInfo




commit 24dbfbfcf2c0b2242221615ffc0d69aba801df4e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Mar 26 11:25:38 2021 +0100

    backends: Store whether views are scaled in MetaViewportInfo
    
    We need to pass this info from the main thread, as that pokes the
    MetaMonitorManager underneath. Store it in the MetaViewportInfo
    so that the input thread can use this information.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1793>

 src/backends/meta-monitor-manager.c |  3 ++-
 src/backends/meta-viewport-info.c   | 12 +++++++++++-
 src/backends/meta-viewport-info.h   |  5 ++++-
 3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 005fa6791b..d535a83da4 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -3448,7 +3448,8 @@ meta_monitor_manager_get_viewports (MetaMonitorManager *manager)
 
   info = meta_viewport_info_new ((cairo_rectangle_int_t *) views->data,
                                  (float *) scales->data,
-                                 views->len);
+                                 views->len,
+                                 meta_is_stage_views_scaled ());
   g_array_unref (views);
   g_array_unref (scales);
 
diff --git a/src/backends/meta-viewport-info.c b/src/backends/meta-viewport-info.c
index c8474f3fad..db7a564c85 100644
--- a/src/backends/meta-viewport-info.c
+++ b/src/backends/meta-viewport-info.c
@@ -38,6 +38,7 @@ struct _MetaViewportInfo
 {
   GObject parent;
   GArray *views;
+  gboolean is_views_scaled;
 };
 
 G_DEFINE_TYPE (MetaViewportInfo, meta_viewport_info, G_TYPE_OBJECT)
@@ -69,7 +70,8 @@ meta_viewport_info_init (MetaViewportInfo *info)
 MetaViewportInfo *
 meta_viewport_info_new (cairo_rectangle_int_t *views,
                         float                 *scales,
-                        int                    n_views)
+                        int                    n_views,
+                        gboolean               is_views_scaled)
 {
   MetaViewportInfo *viewport_info;
   int i;
@@ -85,6 +87,8 @@ meta_viewport_info_new (cairo_rectangle_int_t *views,
       g_array_append_val (viewport_info->views, info);
     }
 
+  viewport_info->is_views_scaled = is_views_scaled;
+
   return viewport_info;
 }
 
@@ -212,3 +216,9 @@ meta_viewport_info_get_extents (MetaViewportInfo *viewport_info,
   if (height)
     *height = (float) max_y - min_y;
 }
+
+gboolean
+meta_viewport_info_is_views_scaled (MetaViewportInfo *viewport_info)
+{
+  return viewport_info->is_views_scaled;
+}
diff --git a/src/backends/meta-viewport-info.h b/src/backends/meta-viewport-info.h
index ea9b8af80c..e10f5b78ff 100644
--- a/src/backends/meta-viewport-info.h
+++ b/src/backends/meta-viewport-info.h
@@ -34,7 +34,8 @@ G_DECLARE_FINAL_TYPE (MetaViewportInfo, meta_viewport_info,
 
 MetaViewportInfo * meta_viewport_info_new (cairo_rectangle_int_t *views,
                                            float                 *scales,
-                                           int                    n_views);
+                                           int                    n_views,
+                                           gboolean               is_views_scaled);
 
 int meta_viewport_info_get_view_at (MetaViewportInfo *info,
                                     float             x,
@@ -55,4 +56,6 @@ void meta_viewport_info_get_extents (MetaViewportInfo *info,
                                      float            *width,
                                      float            *height);
 
+gboolean meta_viewport_info_is_views_scaled (MetaViewportInfo *info);
+
 #endif /* META_VIEWPORT_INFO_H */


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