This saves callers some trouble with identifying which monitor is primary.
Signed-off-by: Zhiyi Zhang <zzhang(a)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