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