wayland: calculate union of geometry of all monitors for toplevel bounds
authorColin Kinloch <colin.kinloch@collabora.com>
Mon, 7 Nov 2022 11:08:18 +0000 (11:08 +0000)
committerSimon McVittie <smcv@debian.org>
Tue, 6 Dec 2022 11:52:29 +0000 (11:52 +0000)
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
Origin: upstream, 4.8.3, commit:e551a9d1c4cbd66be04a1c45af172e7b5872f99c

Gbp-Pq: Name wayland-calculate-union-of-geometry-of-all-monitors-for-t.patch

gdk/wayland/gdksurface-wayland.c

index 225d380536a27b4bb40eaef1d820cdc91466a881..26eacf7c0c1ede03870c637fa942592c54bd4149 100644 (file)
@@ -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);