[RFC PATCH 2/5] winex11: Make GetMonitorInfo() give a different device name (\.\DISPLAY<n>) to each monitor
Kai Krakow
kai at kaishome.de
Mon Aug 20 12:57:48 CDT 2018
From: Ken Thomases <ken at codeweavers.com>
---
dlls/winex11.drv/xinerama.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c
index 0419535d49..24542f4380 100644
--- a/dlls/winex11.drv/xinerama.c
+++ b/dlls/winex11.drv/xinerama.c
@@ -30,6 +30,7 @@
#include "wine/library.h"
#include "x11drv.h"
#include "wine/debug.h"
+#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
@@ -43,6 +44,7 @@ static MONITORINFOEXW default_monitor =
MONITORINFOF_PRIMARY, /* dwFlags */
{ '\\','\\','.','\\','D','I','S','P','L','A','Y','1',0 } /* szDevice */
};
+static const WCHAR monitor_deviceW[] = { '\\','\\','.','\\','D','I','S','P','L','A','Y','%','d',0 };
static MONITORINFOEXW *monitors;
static int nb_monitors;
@@ -141,6 +143,8 @@ static int query_screens(void)
if (monitors != &default_monitor) HeapFree( GetProcessHeap(), 0, monitors );
if ((monitors = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*monitors) )))
{
+ int device = 2; /* 1 is reserved for primary */
+
nb_monitors = count;
for (i = 0; i < nb_monitors; i++)
{
@@ -152,11 +156,15 @@ static int query_screens(void)
monitors[i].dwFlags = 0;
if (!IntersectRect( &monitors[i].rcWork, &rc_work, &monitors[i].rcMonitor ))
monitors[i].rcWork = monitors[i].rcMonitor;
- /* FIXME: using the same device name for all monitors for now */
- lstrcpyW( monitors[i].szDevice, default_monitor.szDevice );
}
get_primary()->dwFlags |= MONITORINFOF_PRIMARY;
+
+ for (i = 0; i < nb_monitors; i++)
+ {
+ snprintfW( monitors[i].szDevice, sizeof(monitors[i].szDevice) / sizeof(WCHAR),
+ monitor_deviceW, (monitors[i].dwFlags & MONITORINFOF_PRIMARY) ? 1 : device++ );
+ }
}
else count = 0;
--
2.16.4
More information about the wine-devel
mailing list