ddraw: Resize the swapchain window on mode changes in exclusive mode.
This commit is contained in:
parent
d977044e76
commit
82dd612d50
|
@ -1357,6 +1357,11 @@ static void CDECL device_parent_wined3d_device_created(struct wined3d_device_par
|
||||||
device->wined3d_device = wined3d_device;
|
device->wined3d_device = wined3d_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
|
||||||
|
{
|
||||||
|
TRACE("device_parent %p.\n", device_parent);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
||||||
|
@ -1538,6 +1543,7 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
|
||||||
static const struct wined3d_device_parent_ops d3d10_wined3d_device_parent_ops =
|
static const struct wined3d_device_parent_ops d3d10_wined3d_device_parent_ops =
|
||||||
{
|
{
|
||||||
device_parent_wined3d_device_created,
|
device_parent_wined3d_device_created,
|
||||||
|
device_parent_mode_changed,
|
||||||
device_parent_create_surface,
|
device_parent_create_surface,
|
||||||
device_parent_create_rendertarget,
|
device_parent_create_rendertarget,
|
||||||
device_parent_create_depth_stencil,
|
device_parent_create_depth_stencil,
|
||||||
|
|
|
@ -2798,6 +2798,11 @@ static void CDECL device_parent_wined3d_device_created(struct wined3d_device_par
|
||||||
TRACE("device_parent %p, device %p\n", device_parent, device);
|
TRACE("device_parent %p, device %p\n", device_parent, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
|
||||||
|
{
|
||||||
|
TRACE("device_parent %p.\n", device_parent);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
||||||
|
@ -2999,6 +3004,7 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
|
||||||
static const struct wined3d_device_parent_ops d3d8_wined3d_device_parent_ops =
|
static const struct wined3d_device_parent_ops d3d8_wined3d_device_parent_ops =
|
||||||
{
|
{
|
||||||
device_parent_wined3d_device_created,
|
device_parent_wined3d_device_created,
|
||||||
|
device_parent_mode_changed,
|
||||||
device_parent_create_surface,
|
device_parent_create_surface,
|
||||||
device_parent_create_rendertarget,
|
device_parent_create_rendertarget,
|
||||||
device_parent_create_depth_stencil,
|
device_parent_create_depth_stencil,
|
||||||
|
|
|
@ -3043,6 +3043,11 @@ static void CDECL device_parent_wined3d_device_created(struct wined3d_device_par
|
||||||
TRACE("device_parent %p, device %p.\n", device_parent, device);
|
TRACE("device_parent %p, device %p.\n", device_parent, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
|
||||||
|
{
|
||||||
|
TRACE("device_parent %p.\n", device_parent);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
||||||
|
@ -3247,6 +3252,7 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
|
||||||
static const struct wined3d_device_parent_ops d3d9_wined3d_device_parent_ops =
|
static const struct wined3d_device_parent_ops d3d9_wined3d_device_parent_ops =
|
||||||
{
|
{
|
||||||
device_parent_wined3d_device_created,
|
device_parent_wined3d_device_created,
|
||||||
|
device_parent_mode_changed,
|
||||||
device_parent_create_surface,
|
device_parent_create_surface,
|
||||||
device_parent_create_rendertarget,
|
device_parent_create_rendertarget,
|
||||||
device_parent_create_depth_stencil,
|
device_parent_create_depth_stencil,
|
||||||
|
|
|
@ -1008,9 +1008,6 @@ static HRESULT ddraw_set_display_mode(IDirectDrawImpl *ddraw, DWORD Width, DWORD
|
||||||
/* TODO: Lose the primary surface */
|
/* TODO: Lose the primary surface */
|
||||||
hr = wined3d_device_set_display_mode(ddraw->wined3d_device, 0, &mode);
|
hr = wined3d_device_set_display_mode(ddraw->wined3d_device, 0, &mode);
|
||||||
|
|
||||||
if (ddraw->cooperative_level & DDSCL_EXCLUSIVE)
|
|
||||||
SetWindowPos(ddraw->dest_window, HWND_TOP, 0, 0, Width, Height, SWP_SHOWWINDOW | SWP_NOACTIVATE);
|
|
||||||
|
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
switch(hr)
|
switch(hr)
|
||||||
|
@ -5268,6 +5265,38 @@ static void CDECL device_parent_wined3d_device_created(struct wined3d_device_par
|
||||||
TRACE("device_parent %p, device %p.\n", device_parent, device);
|
TRACE("device_parent %p, device %p.\n", device_parent, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
|
||||||
|
{
|
||||||
|
struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
|
||||||
|
MONITORINFO monitor_info;
|
||||||
|
HMONITOR monitor;
|
||||||
|
BOOL ret;
|
||||||
|
RECT *r;
|
||||||
|
|
||||||
|
TRACE("device_parent %p.\n", device_parent);
|
||||||
|
|
||||||
|
if (!(ddraw->cooperative_level & DDSCL_EXCLUSIVE) || !ddraw->swapchain_window)
|
||||||
|
{
|
||||||
|
TRACE("Nothing to resize.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
monitor = MonitorFromWindow(ddraw->swapchain_window, MONITOR_DEFAULTTOPRIMARY);
|
||||||
|
monitor_info.cbSize = sizeof(monitor_info);
|
||||||
|
if (!(ret = GetMonitorInfoW(monitor, &monitor_info)))
|
||||||
|
{
|
||||||
|
ERR("Failed to get monitor info.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = &monitor_info.rcMonitor;
|
||||||
|
TRACE("Resizing window %p to %s.\n", ddraw->swapchain_window, wine_dbgstr_rect(r));
|
||||||
|
|
||||||
|
if (!(ret = SetWindowPos(ddraw->swapchain_window, HWND_TOP, r->left, r->top,
|
||||||
|
r->right - r->left, r->bottom - r->top, SWP_SHOWWINDOW | SWP_NOACTIVATE)))
|
||||||
|
ERR("Failed to resize window.\n");
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
||||||
|
@ -5424,6 +5453,7 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
|
||||||
static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops =
|
static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops =
|
||||||
{
|
{
|
||||||
device_parent_wined3d_device_created,
|
device_parent_wined3d_device_created,
|
||||||
|
device_parent_mode_changed,
|
||||||
device_parent_create_surface,
|
device_parent_create_surface,
|
||||||
device_parent_create_rendertarget,
|
device_parent_create_rendertarget,
|
||||||
device_parent_create_depth_stencil,
|
device_parent_create_depth_stencil,
|
||||||
|
|
|
@ -4175,10 +4175,7 @@ static void test_coop_level_mode_set(void)
|
||||||
WM_WINDOWPOSCHANGING,
|
WM_WINDOWPOSCHANGING,
|
||||||
WM_WINDOWPOSCHANGED,
|
WM_WINDOWPOSCHANGED,
|
||||||
WM_SIZE,
|
WM_SIZE,
|
||||||
/* WM_DISPLAYCHANGE, This message is received after WM_SIZE on native. However, the
|
WM_DISPLAYCHANGE,
|
||||||
* more important behaviour is that at the time the WM_SIZE message
|
|
||||||
* is processed SM_CXSCREEN and SM_CYSCREEN already have the new
|
|
||||||
* values. */
|
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6033,6 +6033,10 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
|
||||||
if (device->focus_window == window) device->focus_window = NULL;
|
if (device->focus_window == window) device->focus_window = NULL;
|
||||||
else ERR("Window %p is not the focus window for device %p.\n", window, device);
|
else ERR("Window %p is not the focus window for device %p.\n", window, device);
|
||||||
}
|
}
|
||||||
|
else if (message == WM_DISPLAYCHANGE)
|
||||||
|
{
|
||||||
|
device->device_parent->ops->mode_changed(device->device_parent);
|
||||||
|
}
|
||||||
|
|
||||||
if (unicode)
|
if (unicode)
|
||||||
return CallWindowProcW(proc, window, message, wparam, lparam);
|
return CallWindowProcW(proc, window, message, wparam, lparam);
|
||||||
|
|
|
@ -2066,6 +2066,7 @@ struct wined3d_device_parent
|
||||||
struct wined3d_device_parent_ops
|
struct wined3d_device_parent_ops
|
||||||
{
|
{
|
||||||
void (__cdecl *wined3d_device_created)(struct wined3d_device_parent *device_parent, struct wined3d_device *device);
|
void (__cdecl *wined3d_device_created)(struct wined3d_device_parent *device_parent, struct wined3d_device *device);
|
||||||
|
void (__cdecl *mode_changed)(struct wined3d_device_parent *device_parent);
|
||||||
HRESULT (__cdecl *create_surface)(struct wined3d_device_parent *device_parent, void *container_parent,
|
HRESULT (__cdecl *create_surface)(struct wined3d_device_parent *device_parent, void *container_parent,
|
||||||
UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage, WINED3DPOOL pool,
|
UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage, WINED3DPOOL pool,
|
||||||
UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface);
|
UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface);
|
||||||
|
|
Loading…
Reference in New Issue