Henri Verbeet : ddraw: Get rid of the local "window" variable in ddraw7_SetCooperativeLevel().
Alexandre Julliard
julliard at winehq.org
Tue Jan 15 13:46:17 CST 2013
Module: wine
Branch: master
Commit: a7f4ac283b40d15fa023b5b28e3140069288cf3b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a7f4ac283b40d15fa023b5b28e3140069288cf3b
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Tue Jan 15 08:46:55 2013 +0100
ddraw: Get rid of the local "window" variable in ddraw7_SetCooperativeLevel().
Having both a "hwnd" and a "window" here doesn't exactly make things much
easier to follow.
---
dlls/ddraw/ddraw.c | 34 +++++++++++++++-------------------
1 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 21acc28..a04de34 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -696,23 +696,19 @@ static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL win
* (Probably others too, have to investigate)
*
*****************************************************************************/
-static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, DWORD cooplevel)
+static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND window, DWORD cooplevel)
{
struct ddraw *This = impl_from_IDirectDraw7(iface);
struct wined3d_surface *rt = NULL, *ds = NULL;
struct wined3d_stateblock *stateblock;
BOOL restore_state = FALSE;
- HWND window;
HRESULT hr;
- TRACE("iface %p, window %p, flags %#x.\n", iface, hwnd, cooplevel);
+ TRACE("iface %p, window %p, flags %#x.\n", iface, window, cooplevel);
DDRAW_dump_cooperativelevel(cooplevel);
wined3d_mutex_lock();
- /* Get the old window */
- window = This->dest_window;
-
/* Tests suggest that we need one of them: */
if(!(cooplevel & (DDSCL_SETFOCUSWINDOW |
DDSCL_NORMAL |
@@ -749,14 +745,14 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
return DDERR_INVALIDPARAMS;
}
- hr = ddraw_set_focus_window(This, hwnd);
+ hr = ddraw_set_focus_window(This, window);
wined3d_mutex_unlock();
return hr;
}
if (cooplevel & DDSCL_EXCLUSIVE)
{
- if (!(cooplevel & DDSCL_FULLSCREEN) || !(hwnd || (cooplevel & DDSCL_CREATEDEVICEWINDOW)))
+ if (!(cooplevel & DDSCL_FULLSCREEN) || !(window || (cooplevel & DDSCL_CREATEDEVICEWINDOW)))
{
WARN("DDSCL_EXCLUSIVE requires DDSCL_FULLSCREEN and a window.\n");
wined3d_mutex_unlock();
@@ -794,20 +790,20 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
if (cooplevel & DDSCL_SETFOCUSWINDOW)
{
- if (!hwnd)
+ if (!window)
{
wined3d_mutex_unlock();
return DDERR_NOHWND;
}
- if (FAILED(hr = ddraw_set_focus_window(This, hwnd)))
+ if (FAILED(hr = ddraw_set_focus_window(This, window)))
{
wined3d_mutex_unlock();
return hr;
}
}
- hwnd = device_window;
+ window = device_window;
}
}
else
@@ -819,28 +815,28 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
}
if ((This->cooperative_level & DDSCL_EXCLUSIVE)
- && (hwnd != window || !(cooplevel & DDSCL_EXCLUSIVE)))
+ && (window != This->dest_window || !(cooplevel & DDSCL_EXCLUSIVE)))
wined3d_device_release_focus_window(This->wined3d_device);
- if ((cooplevel & DDSCL_FULLSCREEN) != (This->cooperative_level & DDSCL_FULLSCREEN) || hwnd != window)
+ if ((cooplevel & DDSCL_FULLSCREEN) != (This->cooperative_level & DDSCL_FULLSCREEN) || window != This->dest_window)
{
if (This->cooperative_level & DDSCL_FULLSCREEN)
- wined3d_device_restore_fullscreen_window(This->wined3d_device, window);
+ wined3d_device_restore_fullscreen_window(This->wined3d_device, This->dest_window);
if (cooplevel & DDSCL_FULLSCREEN)
{
struct wined3d_display_mode display_mode;
wined3d_get_adapter_display_mode(This->wined3d, WINED3DADAPTER_DEFAULT, &display_mode, NULL);
- wined3d_device_setup_fullscreen_window(This->wined3d_device, hwnd,
+ wined3d_device_setup_fullscreen_window(This->wined3d_device, window,
display_mode.width, display_mode.height);
}
}
if ((cooplevel & DDSCL_EXCLUSIVE)
- && (hwnd != window || !(This->cooperative_level & DDSCL_EXCLUSIVE)))
+ && (window != This->dest_window || !(This->cooperative_level & DDSCL_EXCLUSIVE)))
{
- hr = wined3d_device_acquire_focus_window(This->wined3d_device, hwnd);
+ hr = wined3d_device_acquire_focus_window(This->wined3d_device, window);
if (FAILED(hr))
{
ERR("Failed to acquire focus window, hr %#x.\n", hr);
@@ -879,7 +875,7 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
ddraw_destroy_swapchain(This);
}
- if (FAILED(hr = ddraw_create_swapchain(This, hwnd, !(cooplevel & DDSCL_FULLSCREEN))))
+ if (FAILED(hr = ddraw_create_swapchain(This, window, !(cooplevel & DDSCL_FULLSCREEN))))
ERR("Failed to create swapchain, hr %#x.\n", hr);
if (restore_state)
@@ -915,7 +911,7 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
/* Store the cooperative_level */
This->cooperative_level = cooplevel;
- This->dest_window = hwnd;
+ This->dest_window = window;
TRACE("SetCooperativeLevel retuning DD_OK\n");
wined3d_mutex_unlock();
More information about the wine-cvs
mailing list