From f1c6b23eaa0e22dc5de343f4479e095b3ce261e4 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Tue, 12 Dec 2006 17:56:27 +0000 Subject: [PATCH] remove fireball hack in changedisplay, do not hard code the display number, with this patch we are now extract the display number from the desktop and use it patch was wroten by me and janderwald. I was to lazy finish it so janderwald did finish it thanks janderwald. svn path=/trunk/; revision=25131 --- reactos/subsystems/win32/win32k/objects/dc.c | 27 +++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/reactos/subsystems/win32/win32k/objects/dc.c b/reactos/subsystems/win32/win32k/objects/dc.c index de2c20b1db7..aea778ceb9c 100644 --- a/reactos/subsystems/win32/win32k/objects/dc.c +++ b/reactos/subsystems/win32/win32k/objects/dc.c @@ -2925,9 +2925,30 @@ IntChangeDisplaySettings( /* Check if pDeviceName is NULL, we need to retrieve it */ if (pDeviceName == NULL) - { - /* FIXME: It is a hack, but there is no proper way right now */ - RtlInitUnicodeString(&InDeviceName, L"\\\\.\\DISPLAY1"); + { + WCHAR szBuffer[MAX_DRIVER_NAME]; + PDC DC; + PWINDOW_OBJECT Wnd=NULL; + HWND hWnd; + HDC hDC; + + hWnd = IntGetDesktopWindow(); + if (hWnd && !(Wnd = UserGetWindowObject(hWnd))) + { + return FALSE; + } + + hDC = (HDC)UserGetWindowDC(Wnd); + + DC = DC_LockDc(hDC); + if (NULL == DC) + { + return FALSE; + } + swprintf (szBuffer, L"\\\\.\\DISPLAY%lu", ((GDIDEVICE *)DC->GDIDevice)->DisplayNumber); + DC_UnlockDc(DC); + + RtlInitUnicodeString(&InDeviceName, szBuffer); pDeviceName = &InDeviceName; }