From e551a9d1c4cbd66be04a1c45af172e7b5872f99c Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Mon, 7 Nov 2022 11:08:18 +0000 Subject: [PATCH] wayland: calculate union of geometry of all monitors for toplevel bounds Signed-off-by: Colin Kinloch --- gdk/wayland/gdksurface-wayland.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 225d380536..26eacf7c0c 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -1416,21 +1416,22 @@ configure_toplevel_geometry (GdkSurface *surface) else { 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); - if (monitor) + monitors = gdk_display_get_monitors (display); + + 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); - bounds_width = monitor_geometry.width; - bounds_height = monitor_geometry.height; + gdk_rectangle_union (&display_geometry, &monitor_geometry, &display_geometry); g_object_unref (monitor); } - else - { - bounds_width = 0; - bounds_height = 0; - } + + bounds_width = display_geometry.width; + bounds_height = display_geometry.height; } gdk_toplevel_size_init (&size, bounds_width, bounds_height);