Blame SOURCES/0001-Calculate-better-extents-for-the-configured-displays.patch

60072f
From 9921b90dc1a91ff040e021a78dcf539df42f5952 Mon Sep 17 00:00:00 2001
60072f
From: Carlos Garnacho <carlosg@gnome.org>
60072f
Date: Thu, 8 Aug 2019 20:32:10 +0200
60072f
Subject: [PATCH] Calculate better extents for the configured displays
60072f
 arrangement
60072f
60072f
Find out the bottommost and rightmost outputs in the arranged space, so
60072f
the represented outputs in the arrangement widget use as much space as
60072f
possible, instead of allocating enough space to allow any kind of
60072f
configuration beforehand.
60072f
---
60072f
 panels/display/cc-display-panel.c | 12 ++++++++----
60072f
 1 file changed, 8 insertions(+), 4 deletions(-)
60072f
60072f
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
60072f
index 0b4fa19..a3db5f6 100644
60072f
--- a/panels/display/cc-display-panel.c
60072f
+++ b/panels/display/cc-display-panel.c
60072f
@@ -2137,6 +2137,7 @@ static void
60072f
 get_total_size (CcDisplayPanel *self, int *total_w, int *total_h)
60072f
 {
60072f
   GList *outputs, *l;
60072f
+  int max_w = 0, max_h = 0;
60072f
 
60072f
   *total_w = 0;
60072f
   *total_h = 0;
60072f
@@ -2145,12 +2146,12 @@ get_total_size (CcDisplayPanel *self, int *total_w, int *total_h)
60072f
   for (l = outputs; l != NULL; l = l->next)
60072f
     {
60072f
       CcDisplayMonitor *output = l->data;
60072f
-      int w, h;
60072f
+      int w, h, x, y;
60072f
 
60072f
       if (!is_output_useful (output))
60072f
         continue;
60072f
 
60072f
-      get_geometry (output, NULL, NULL, &w, &h);
60072f
+      get_geometry (output, &x, &y, &w, &h);
60072f
 
60072f
       if (cc_display_config_is_layout_logical (self->priv->current_config))
60072f
         {
60072f
@@ -2159,9 +2160,12 @@ get_total_size (CcDisplayPanel *self, int *total_w, int *total_h)
60072f
           h /= scale;
60072f
         }
60072f
 
60072f
-      *total_w += w;
60072f
-      *total_h += h;
60072f
+      max_w = MAX (max_w, x + w);
60072f
+      max_h = MAX (max_h, y + h);
60072f
     }
60072f
+
60072f
+  *total_w = max_w;
60072f
+  *total_h = max_h;
60072f
 }
60072f
 
60072f
 static double
60072f
-- 
60072f
2.23.0.rc1
60072f