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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c index 739b139736..fe899e8744 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}; + MONITORINFOEXW *primary_monitor; if (!monitors) /* first time around */ load_xinerama(); @@ -156,7 +157,16 @@ static int query_screens(void) lstrcpyW( monitors[i].szDevice, default_monitor.szDevice ); } - get_primary()->dwFlags |= MONITORINFOF_PRIMARY; + primary_monitor = get_primary(); + primary_monitor->dwFlags |= MONITORINFOF_PRIMARY; + + /* Make primary monitor always the first one */ + if (primary_monitor != &monitors[0]) + { + MONITORINFOEXW tmp = monitors[0]; + monitors[0] = *primary_monitor; + *primary_monitor = tmp; + } } else count = 0; -- 2.19.2