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>
This commit is contained in:
Carlos Garnacho 2021-03-26 11:25:38 +01:00 committed by Marge Bot
parent 5a565b4258
commit 24dbfbfcf2
3 changed files with 17 additions and 3 deletions

View File

@ -3448,7 +3448,8 @@ meta_monitor_manager_get_viewports (MetaMonitorManager *manager)
info = meta_viewport_info_new ((cairo_rectangle_int_t *) views->data, info = meta_viewport_info_new ((cairo_rectangle_int_t *) views->data,
(float *) scales->data, (float *) scales->data,
views->len); views->len,
meta_is_stage_views_scaled ());
g_array_unref (views); g_array_unref (views);
g_array_unref (scales); g_array_unref (scales);

View File

@ -38,6 +38,7 @@ struct _MetaViewportInfo
{ {
GObject parent; GObject parent;
GArray *views; GArray *views;
gboolean is_views_scaled;
}; };
G_DEFINE_TYPE (MetaViewportInfo, meta_viewport_info, G_TYPE_OBJECT) G_DEFINE_TYPE (MetaViewportInfo, meta_viewport_info, G_TYPE_OBJECT)
@ -69,7 +70,8 @@ meta_viewport_info_init (MetaViewportInfo *info)
MetaViewportInfo * MetaViewportInfo *
meta_viewport_info_new (cairo_rectangle_int_t *views, meta_viewport_info_new (cairo_rectangle_int_t *views,
float *scales, float *scales,
int n_views) int n_views,
gboolean is_views_scaled)
{ {
MetaViewportInfo *viewport_info; MetaViewportInfo *viewport_info;
int i; int i;
@ -85,6 +87,8 @@ meta_viewport_info_new (cairo_rectangle_int_t *views,
g_array_append_val (viewport_info->views, info); g_array_append_val (viewport_info->views, info);
} }
viewport_info->is_views_scaled = is_views_scaled;
return viewport_info; return viewport_info;
} }
@ -212,3 +216,9 @@ meta_viewport_info_get_extents (MetaViewportInfo *viewport_info,
if (height) if (height)
*height = (float) max_y - min_y; *height = (float) max_y - min_y;
} }
gboolean
meta_viewport_info_is_views_scaled (MetaViewportInfo *viewport_info)
{
return viewport_info->is_views_scaled;
}

View File

@ -34,7 +34,8 @@ G_DECLARE_FINAL_TYPE (MetaViewportInfo, meta_viewport_info,
MetaViewportInfo * meta_viewport_info_new (cairo_rectangle_int_t *views, MetaViewportInfo * meta_viewport_info_new (cairo_rectangle_int_t *views,
float *scales, float *scales,
int n_views); int n_views,
gboolean is_views_scaled);
int meta_viewport_info_get_view_at (MetaViewportInfo *info, int meta_viewport_info_get_view_at (MetaViewportInfo *info,
float x, float x,
@ -55,4 +56,6 @@ void meta_viewport_info_get_extents (MetaViewportInfo *info,
float *width, float *width,
float *height); float *height);
gboolean meta_viewport_info_is_views_scaled (MetaViewportInfo *info);
#endif /* META_VIEWPORT_INFO_H */ #endif /* META_VIEWPORT_INFO_H */