user32: Initialize more fields in the DEVMODE structure.

This commit is contained in:
Dmitry Timoshkov 2007-11-01 14:22:41 +08:00 committed by Alexandre Julliard
parent d43fdc5ab0
commit 2712eb50b1
2 changed files with 32 additions and 10 deletions

View File

@ -2985,7 +2985,6 @@ LONG WINAPI ChangeDisplaySettingsW( LPDEVMODEW devmode, DWORD flags )
LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND hwnd,
DWORD flags, LPVOID lparam )
{
DEVMODEW devmodeW;
LONG ret;
UNICODE_STRING nameW;
@ -2994,13 +2993,11 @@ LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND h
if (devmode)
{
devmodeW.dmBitsPerPel = devmode->dmBitsPerPel;
devmodeW.dmPelsHeight = devmode->dmPelsHeight;
devmodeW.dmPelsWidth = devmode->dmPelsWidth;
devmodeW.dmDisplayFlags = devmode->dmDisplayFlags;
devmodeW.dmDisplayFrequency = devmode->dmDisplayFrequency;
devmodeW.dmFields = devmode->dmFields;
ret = ChangeDisplaySettingsExW(nameW.Buffer, &devmodeW, hwnd, flags, lparam);
DEVMODEW *devmodeW;
devmodeW = GdiConvertToDevmodeW(devmode);
ret = ChangeDisplaySettingsExW(nameW.Buffer, devmodeW, hwnd, flags, lparam);
HeapFree(GetProcessHeap(), 0, devmodeW);
}
else
{
@ -3063,12 +3060,23 @@ BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
ret = EnumDisplaySettingsExW(nameW.Buffer,iModeNum,&devmodeW,dwFlags);
if (ret)
{
lpDevMode->dmSize = sizeof(*lpDevMode);
lpDevMode->dmSpecVersion = devmodeW.dmSpecVersion;
lpDevMode->dmDriverVersion = devmodeW.dmDriverVersion;
WideCharToMultiByte(CP_ACP, 0, devmodeW.dmDeviceName, -1,
(LPSTR)lpDevMode->dmDeviceName, CCHDEVICENAME, NULL, NULL);
lpDevMode->dmDriverExtra = 0; /* FIXME */
lpDevMode->dmBitsPerPel = devmodeW.dmBitsPerPel;
lpDevMode->dmPelsHeight = devmodeW.dmPelsHeight;
lpDevMode->dmPelsWidth = devmodeW.dmPelsWidth;
lpDevMode->dmDisplayFlags = devmodeW.dmDisplayFlags;
lpDevMode->dmDisplayFrequency = devmodeW.dmDisplayFrequency;
lpDevMode->dmFields = devmodeW.dmFields;
lpDevMode->dmPosition.x = devmodeW.dmPosition.x;
lpDevMode->dmPosition.y = devmodeW.dmPosition.y;
lpDevMode->dmDisplayOrientation = devmodeW.dmDisplayOrientation;
lpDevMode->dmDisplayFixedOutput = devmodeW.dmDisplayFixedOutput;
}
if (lpszDeviceName) RtlFreeUnicodeString(&nameW);
return ret;

View File

@ -165,11 +165,25 @@ void X11DRV_Settings_Init(void)
*/
BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DWORD flags)
{
DWORD dwBpp = screen_depth;
static const WCHAR dev_name[CCHDEVICENAME] =
{ 'W','i','n','e',' ','X','1','1',' ','d','r','i','v','e','r',0 };
DWORD dwBpp;
dwBpp = screen_depth;
if (dwBpp == 24) dwBpp = 32;
devmode->dmSize = sizeof(DEVMODEW);
devmode->dmSpecVersion = MAKEWORD(1,4);
devmode->dmDriverVersion = MAKEWORD(1,4);
memcpy(devmode->dmDeviceName, dev_name, sizeof(dev_name));
devmode->dmDriverExtra = 0;
devmode->dmDisplayFlags = 0;
devmode->dmDisplayFrequency = 0;
devmode->dmSize = sizeof(DEVMODEW);
devmode->dmPosition.x = 0;
devmode->dmPosition.y = 0;
devmode->dmDisplayOrientation = 0;
devmode->dmDisplayFixedOutput = 0;
if (n == ENUM_CURRENT_SETTINGS)
{
TRACE("mode %d (current) -- getting current mode (%s)\n", n, handler_name);