Merge branch 'wayland_display_geometry' into 'main'

wayland: calculate union of geometry of all monitors for toplevel bounds

See merge request GNOME/gtk!4790
This commit is contained in:
Matthias Clasen 2022-11-08 16:29:15 +00:00
commit 956100017c

View File

@ -1416,21 +1416,22 @@ configure_toplevel_geometry (GdkSurface *surface)
else else
{ {
GdkMonitor *monitor; GdkMonitor *monitor;
GdkRectangle monitor_geometry; GListModel *monitors;
GdkRectangle monitor_geometry, display_geometry = { 0 };
guint i;
monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0); monitors = gdk_display_get_monitors (display);
if (monitor)
for (i = 0; i < g_list_model_get_n_items (monitors); i++)
{ {
monitor = g_list_model_get_item (monitors, i);
gdk_monitor_get_geometry (monitor, &monitor_geometry); gdk_monitor_get_geometry (monitor, &monitor_geometry);
bounds_width = monitor_geometry.width; gdk_rectangle_union (&display_geometry, &monitor_geometry, &display_geometry);
bounds_height = monitor_geometry.height;
g_object_unref (monitor); g_object_unref (monitor);
} }
else
{ bounds_width = display_geometry.width;
bounds_width = 0; bounds_height = display_geometry.height;
bounds_height = 0;
}
} }
gdk_toplevel_size_init (&size, bounds_width, bounds_height); gdk_toplevel_size_init (&size, bounds_width, bounds_height);