[PATCH rebase 2/7] winex11.drv: Report primary monitor first with Xinerama.

Zhiyi Zhang zzhang at codeweavers.com
Thu Apr 4 03:20:10 CDT 2019


This saves callers some trouble with identifying which monitor is primary.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/winex11.drv/xinerama.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c
index 739b139736..42bf34cc46 100644
--- a/dlls/winex11.drv/xinerama.c
+++ b/dlls/winex11.drv/xinerama.c
@@ -128,6 +128,7 @@ static int query_screens(void)
     int i, count, event_base, error_base;
     XineramaScreenInfo *screens;
     RECT rc_work = {0, 0, 0, 0};
+    INT primary_index;
 
     if (!monitors)  /* first time around */
         load_xinerama();
@@ -157,6 +158,18 @@ static int query_screens(void)
         }
 
         get_primary()->dwFlags |= MONITORINFOF_PRIMARY;
+
+        /* Make primary monitor always the first one */
+        primary_index = primary_monitor;
+        if (primary_index >= nb_monitors)
+            primary_index = 0;
+
+        if (primary_index)
+        {
+            MONITORINFOEXW tmp = monitors[0];
+            monitors[0] = monitors[i];
+            monitors[i] = tmp;
+        }
     }
     else count = 0;
 
-- 
2.20.1





More information about the wine-devel mailing list