From af4017de49f08b8998c9f4d805007f4eb4c92d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 21 Mar 2017 16:38:45 +0800 Subject: [PATCH] monitor-manager: Derive logical monitor position from top left CRTC Derive the logical monitor position not by looking at the main output (the (0, 0) tile), but the one that is placed on the top-left corner. This might be the non-main output on certain transformations. https://bugzilla.gnome.org/show_bug.cgi?id=777732 --- src/backends/meta-monitor-manager.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index 31fb67864..1b9bcc756 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -158,11 +158,25 @@ static void derive_monitor_layout (MetaMonitor *monitor, MetaRectangle *layout) { - MetaOutput *main_output; + GList *outputs; + GList *l; + int x = INT_MAX; + int y = INT_MAX; - main_output = meta_monitor_get_main_output (monitor); - layout->x = main_output->crtc->rect.x; - layout->y = main_output->crtc->rect.y; + outputs = meta_monitor_get_outputs (monitor); + for (l = outputs; l; l = l->next) + { + MetaOutput *output = l->data; + + if (!output->crtc) + continue; + + x = MIN (x, output->crtc->rect.x); + y = MIN (y, output->crtc->rect.y); + } + + layout->x = x; + layout->y = y; meta_monitor_derive_dimensions (monitor, &layout->width, &layout->height); }