[mutter] monitor-manager: Derive logical monitor position from top left CRTC



commit af4017de49f08b8998c9f4d805007f4eb4c92d72
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Mar 21 16:38:45 2017 +0800

    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 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 31fb678..1b9bcc7 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;
+
+  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);
+    }
 
-  main_output = meta_monitor_get_main_output (monitor);
-  layout->x = main_output->crtc->rect.x;
-  layout->y = main_output->crtc->rect.y;
+  layout->x = x;
+  layout->y = y;
 
   meta_monitor_derive_dimensions (monitor, &layout->width, &layout->height);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]