Commit 4ce220e4 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

win32u: Set generic DEVMODEW fields in NtUserEnumDisplaySettings.

parent 360f12d3
......@@ -1926,14 +1926,14 @@ LONG WINAPI NtUserChangeDisplaySettings( UNICODE_STRING *devname, DEVMODEW *devm
/***********************************************************************
* NtUserEnumDisplaySettings (win32u.@)
*/
BOOL WINAPI NtUserEnumDisplaySettings( UNICODE_STRING *device, DWORD mode,
DEVMODEW *dev_mode, DWORD flags )
BOOL WINAPI NtUserEnumDisplaySettings( UNICODE_STRING *device, DWORD index, DEVMODEW *devmode, DWORD flags )
{
static const WCHAR wine_display_driverW[] = {'W','i','n','e',' ','D','i','s','p','l','a','y',' ','D','r','i','v','e','r',0};
WCHAR device_name[CCHDEVICENAME];
struct adapter *adapter;
BOOL ret;
TRACE( "%s %#x %p %#x\n", debugstr_us(device), mode, dev_mode, flags );
TRACE( "device %s, index %#x, devmode %p, flags %#x\n", debugstr_us(device), index, devmode, flags );
if (!lock_display_devices()) return FALSE;
if ((adapter = find_adapter( device ))) lstrcpyW( device_name, adapter->dev.device_name );
......@@ -1944,15 +1944,18 @@ BOOL WINAPI NtUserEnumDisplaySettings( UNICODE_STRING *device, DWORD mode,
return FALSE;
}
ret = user_driver->pEnumDisplaySettingsEx( device_name, mode, dev_mode, flags );
if (ret)
TRACE( "device:%s mode index:%#x position:(%d,%d) resolution:%ux%u frequency:%uHz "
"depth:%ubits orientation:%#x.\n", debugstr_w(device_name), mode,
dev_mode->dmPosition.x, dev_mode->dmPosition.y, dev_mode->dmPelsWidth,
dev_mode->dmPelsHeight, dev_mode->dmDisplayFrequency, dev_mode->dmBitsPerPel,
dev_mode->dmDisplayOrientation );
else
WARN( "Failed to query %s display settings.\n", wine_dbgstr_w(device_name) );
lstrcpynW( devmode->dmDeviceName, wine_display_driverW, ARRAY_SIZE(devmode->dmDeviceName) );
devmode->dmSpecVersion = DM_SPECVERSION;
devmode->dmDriverVersion = DM_SPECVERSION;
devmode->dmSize = offsetof(DEVMODEW, dmICMMethod);
memset( &devmode->dmDriverExtra, 0, devmode->dmSize - offsetof(DEVMODEW, dmDriverExtra) );
ret = user_driver->pEnumDisplaySettingsEx( device_name, index, devmode, flags );
if (!ret) WARN( "Failed to query %s display settings.\n", debugstr_w(device_name) );
else TRACE( "position %dx%d, resolution %ux%u, frequency %u, depth %u, orientation %#x.\n",
devmode->dmPosition.x, devmode->dmPosition.y, devmode->dmPelsWidth, devmode->dmPelsHeight,
devmode->dmDisplayFrequency, devmode->dmBitsPerPel, devmode->dmDisplayOrientation );
return ret;
}
......
......@@ -303,14 +303,6 @@ BOOL ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manag
*/
BOOL ANDROID_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DWORD flags )
{
static const WCHAR dev_name[CCHDEVICENAME] =
{ 'W','i','n','e',' ','A','n','d','r','o','i','d',' ','d','r','i','v','e','r',0 };
devmode->dmSize = offsetof( DEVMODEW, dmICMMethod );
devmode->dmSpecVersion = DM_SPECVERSION;
devmode->dmDriverVersion = DM_SPECVERSION;
memcpy( devmode->dmDeviceName, dev_name, sizeof(dev_name) );
devmode->dmDriverExtra = 0;
devmode->u2.dmDisplayFlags = 0;
devmode->dmDisplayFrequency = 0;
devmode->u1.s2.dmPosition.x = 0;
......
......@@ -1044,8 +1044,6 @@ better:
*/
BOOL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode, DEVMODEW *devmode, DWORD flags)
{
static const WCHAR dev_name[CCHDEVICENAME] =
{ 'W','i','n','e',' ','M','a','c',' ','d','r','i','v','e','r',0 };
struct macdrv_display *displays = NULL;
int num_displays;
CGDisplayModeRef display_mode;
......@@ -1058,13 +1056,6 @@ BOOL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode, DEVMODEW *devmode
init_original_display_mode();
memcpy(devmode->dmDeviceName, dev_name, sizeof(dev_name));
devmode->dmSpecVersion = DM_SPECVERSION;
devmode->dmDriverVersion = DM_SPECVERSION;
devmode->dmSize = FIELD_OFFSET(DEVMODEW, dmICMMethod);
devmode->dmDriverExtra = 0;
memset(&devmode->dmFields, 0, devmode->dmSize - FIELD_OFFSET(DEVMODEW, dmFields));
if (mode == ENUM_REGISTRY_SETTINGS)
{
TRACE("mode %d (registry) -- getting default mode\n", mode);
......
......@@ -464,9 +464,7 @@ static DWORD get_display_depth(ULONG_PTR display_id)
*/
BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DWORD flags)
{
static const WCHAR dev_name[CCHDEVICENAME] =
{ 'W','i','n','e',' ','X','1','1',' ','d','r','i','v','e','r',0 };
DEVMODEW *modes;
DEVMODEW *modes, mode;
UINT mode_count;
ULONG_PTR id;
......@@ -477,21 +475,20 @@ BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DW
ERR("Failed to get %s registry display settings.\n", wine_dbgstr_w(name));
return FALSE;
}
goto done;
return TRUE;
}
if (n == ENUM_CURRENT_SETTINGS)
{
if (!settings_handler.get_id(name, &id) || !settings_handler.get_current_mode(id, devmode))
if (!settings_handler.get_id( name, &id ) || !settings_handler.get_current_mode( id, &mode ))
{
ERR("Failed to get %s current display settings.\n", wine_dbgstr_w(name));
return FALSE;
}
if (!is_detached_mode(devmode))
devmode->dmBitsPerPel = get_display_depth(id);
goto done;
memcpy( &devmode->dmFields, &mode.dmFields, devmode->dmSize - offsetof(DEVMODEW, dmFields) );
if (!is_detached_mode( devmode )) devmode->dmBitsPerPel = get_display_depth( id );
return TRUE;
}
pthread_mutex_lock( &settings_mutex );
......@@ -522,16 +519,10 @@ BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DW
return FALSE;
}
memcpy(devmode, (BYTE *)cached_modes + (sizeof(*cached_modes) + cached_modes[0].dmDriverExtra) * n, sizeof(*devmode));
mode = *(DEVMODEW *)((BYTE *)cached_modes + (sizeof(*cached_modes) + cached_modes[0].dmDriverExtra) * n);
pthread_mutex_unlock( &settings_mutex );
done:
/* Set generic fields */
devmode->dmSize = FIELD_OFFSET(DEVMODEW, dmICMMethod);
devmode->dmDriverExtra = 0;
devmode->dmSpecVersion = DM_SPECVERSION;
devmode->dmDriverVersion = DM_SPECVERSION;
lstrcpyW(devmode->dmDeviceName, dev_name);
memcpy( &devmode->dmFields, &mode.dmFields, devmode->dmSize - offsetof(DEVMODEW, dmFields) );
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment