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

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