From 4cfcd4bce08926e4e9005cd912c81e83819194d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 8 Mar 2017 15:53:24 +0800 Subject: [PATCH] monitor-tiled: Derive the dimension from what was configured Previously, the size of the logical monitor was derived directly from the tiling information. This works fine until we add transformations, or set modes with a dimension different from the resulting resolution when tiled. Fix this by traversing the assigned CRTC rects, as these are already transformed by the configuration system. https://bugzilla.gnome.org/show_bug.cgi?id=779745 --- src/backends/meta-monitor.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c index 57eea8446..f6eb2278b 100644 --- a/src/backends/meta-monitor.c +++ b/src/backends/meta-monitor.c @@ -702,11 +702,12 @@ meta_monitor_tiled_derive_dimensions (MetaMonitor *monitor, MetaMonitorPrivate *monitor_priv = meta_monitor_get_instance_private (monitor); GList *l; - int width; - int height; + int min_x, min_y, max_x, max_y; - width = 0; - height = 0; + min_x = INT_MAX; + min_y = INT_MAX; + max_x = 0; + max_y = 0; for (l = monitor_priv->outputs; l; l = l->next) { MetaOutput *output = l->data; @@ -714,15 +715,14 @@ meta_monitor_tiled_derive_dimensions (MetaMonitor *monitor, if (!output->crtc) continue; - if (output->tile_info.loc_v_tile == 0) - width += output->crtc->rect.width; - - if (output->tile_info.loc_h_tile == 0) - height += output->crtc->rect.height; + min_x = MIN (output->crtc->rect.x, min_x); + min_y = MIN (output->crtc->rect.y, min_y); + max_x = MAX (output->crtc->rect.x + output->crtc->rect.width, max_x); + max_y = MAX (output->crtc->rect.y + output->crtc->rect.height, max_y); } - *out_width = width; - *out_height = height; + *out_width = max_x - min_x; + *out_height = max_y - min_y; } static void