Commit 56c518af authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Use the device name stored in the adapter in wined3d_get_adapter_display_mode().

parent 2e167f68
...@@ -3002,6 +3002,7 @@ HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UI ...@@ -3002,6 +3002,7 @@ HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UI
struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation) struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
{ {
const struct wined3d_adapter *adapter; const struct wined3d_adapter *adapter;
DEVMODEW m;
TRACE("wined3d %p, adapter_idx %u, display_mode %p, rotation %p.\n", TRACE("wined3d %p, adapter_idx %u, display_mode %p, rotation %p.\n",
wined3d, adapter_idx, mode, rotation); wined3d, adapter_idx, mode, rotation);
...@@ -3011,67 +3012,58 @@ HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UI ...@@ -3011,67 +3012,58 @@ HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UI
adapter = &wined3d->adapters[adapter_idx]; adapter = &wined3d->adapters[adapter_idx];
if (!adapter_idx) memset(&m, 0, sizeof(m));
{ m.dmSize = sizeof(m);
DEVMODEW DevModeW;
ZeroMemory(&DevModeW, sizeof(DevModeW));
DevModeW.dmSize = sizeof(DevModeW);
EnumDisplaySettingsExW(NULL, ENUM_CURRENT_SETTINGS, &DevModeW, 0); EnumDisplaySettingsExW(adapter->DeviceName, ENUM_CURRENT_SETTINGS, &m, 0);
mode->width = DevModeW.dmPelsWidth; mode->width = m.dmPelsWidth;
mode->height = DevModeW.dmPelsHeight; mode->height = m.dmPelsHeight;
mode->refresh_rate = DEFAULT_REFRESH_RATE; mode->refresh_rate = DEFAULT_REFRESH_RATE;
if (DevModeW.dmFields & DM_DISPLAYFREQUENCY) if (m.dmFields & DM_DISPLAYFREQUENCY)
mode->refresh_rate = DevModeW.dmDisplayFrequency; mode->refresh_rate = m.dmDisplayFrequency;
mode->format_id = pixelformat_for_depth(DevModeW.dmBitsPerPel); mode->format_id = pixelformat_for_depth(m.dmBitsPerPel);
/* Lie about the format. X11 can't change the color depth, and some /* Lie about the format. X11 can't change the color depth, and some apps
* apps are pretty angry if they SetDisplayMode from 24 to 16 bpp and * are pretty angry if they SetDisplayMode from 24 to 16 bpp and find out
* find out that GetDisplayMode still returns 24 bpp. This should * that GetDisplayMode still returns 24 bpp. This should probably be
* probably be handled in winex11 instead. */ * handled in winex11 instead. */
if (adapter->screen_format && adapter->screen_format != mode->format_id) if (adapter->screen_format && adapter->screen_format != mode->format_id)
{ {
WARN("Overriding format %s with stored format %s.\n", WARN("Overriding format %s with stored format %s.\n",
debug_d3dformat(mode->format_id), debug_d3dformat(mode->format_id),
debug_d3dformat(adapter->screen_format)); debug_d3dformat(adapter->screen_format));
mode->format_id = adapter->screen_format; mode->format_id = adapter->screen_format;
} }
if (!(DevModeW.dmFields & DM_DISPLAYFLAGS)) if (!(m.dmFields & DM_DISPLAYFLAGS))
mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN; mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
else if (DevModeW.u2.dmDisplayFlags & DM_INTERLACED) else if (m.u2.dmDisplayFlags & DM_INTERLACED)
mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_INTERLACED; mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_INTERLACED;
else else
mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_PROGRESSIVE; mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_PROGRESSIVE;
if (rotation) if (rotation)
{
switch (m.u1.s2.dmDisplayOrientation)
{ {
switch (DevModeW.u1.s2.dmDisplayOrientation) case DMDO_DEFAULT:
{ *rotation = WINED3D_DISPLAY_ROTATION_0;
case DMDO_DEFAULT: break;
*rotation = WINED3D_DISPLAY_ROTATION_0; case DMDO_90:
break; *rotation = WINED3D_DISPLAY_ROTATION_90;
case DMDO_90: break;
*rotation = WINED3D_DISPLAY_ROTATION_90; case DMDO_180:
break; *rotation = WINED3D_DISPLAY_ROTATION_180;
case DMDO_180: break;
*rotation = WINED3D_DISPLAY_ROTATION_180; case DMDO_270:
break; *rotation = WINED3D_DISPLAY_ROTATION_270;
case DMDO_270: break;
*rotation = WINED3D_DISPLAY_ROTATION_270; default:
break; FIXME("Unhandled display rotation %#x.\n", m.u1.s2.dmDisplayOrientation);
default: *rotation = WINED3D_DISPLAY_ROTATION_UNSPECIFIED;
FIXME("Unhandled display rotation %#x.\n", DevModeW.u1.s2.dmDisplayOrientation); break;
*rotation = WINED3D_DISPLAY_ROTATION_UNSPECIFIED;
break;
}
} }
} }
else
{
FIXME("Adapter not primary display.\n");
}
TRACE("Returning %ux%u@%u %s %#x.\n", mode->width, mode->height, TRACE("Returning %ux%u@%u %s %#x.\n", mode->width, mode->height,
mode->refresh_rate, debug_d3dformat(mode->format_id), mode->refresh_rate, debug_d3dformat(mode->format_id),
......
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