ddraw: Only modify the ddraw destination window at the end of ddraw7_SetCooperativeLevel().
We want this to happen after ddraw_destroy_swapchain() in particular, because dest_window being different from d3d_window will cause it to destroy d3d_window, but this seems like a good idea in general.
This commit is contained in:
parent
ae725df54a
commit
292522c4ad
@ -551,9 +551,6 @@ static HRESULT ddraw_set_focus_window(struct ddraw *ddraw, HWND window)
|
||||
|
||||
ddraw->focuswindow = window;
|
||||
|
||||
/* Use the focus window for drawing too. */
|
||||
ddraw->dest_window = ddraw->focuswindow;
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
@ -852,10 +849,6 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't override focus windows or private device windows */
|
||||
if (hwnd && !This->focuswindow && !This->devicewindow && (hwnd != window))
|
||||
This->dest_window = hwnd;
|
||||
|
||||
if (cooplevel & DDSCL_MULTITHREADED && !(This->cooperative_level & DDSCL_MULTITHREADED))
|
||||
wined3d_device_set_multithreaded(This->wined3d_device);
|
||||
|
||||
@ -886,7 +879,7 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
|
||||
ddraw_destroy_swapchain(This);
|
||||
}
|
||||
|
||||
if (FAILED(hr = ddraw_create_swapchain(This, This->dest_window, !(cooplevel & DDSCL_FULLSCREEN))))
|
||||
if (FAILED(hr = ddraw_create_swapchain(This, hwnd, !(cooplevel & DDSCL_FULLSCREEN))))
|
||||
ERR("Failed to create swapchain, hr %#x.\n", hr);
|
||||
|
||||
if (restore_state)
|
||||
@ -922,6 +915,7 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
|
||||
|
||||
/* Store the cooperative_level */
|
||||
This->cooperative_level = cooplevel;
|
||||
This->dest_window = hwnd;
|
||||
TRACE("SetCooperativeLevel retuning DD_OK\n");
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -2651,7 +2651,7 @@ static void test_coop_level_multi_window(void)
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
hr = IDirectDraw_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
todo_wine ok(IsWindow(window1), "Window 1 was destroyed.\n");
|
||||
ok(IsWindow(window1), "Window 1 was destroyed.\n");
|
||||
ok(IsWindow(window2), "Window 2 was destroyed.\n");
|
||||
|
||||
IDirectDraw_Release(ddraw);
|
||||
|
@ -2770,7 +2770,7 @@ static void test_coop_level_multi_window(void)
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
todo_wine ok(IsWindow(window1), "Window 1 was destroyed.\n");
|
||||
ok(IsWindow(window1), "Window 1 was destroyed.\n");
|
||||
ok(IsWindow(window2), "Window 2 was destroyed.\n");
|
||||
|
||||
IDirectDraw2_Release(ddraw);
|
||||
|
@ -2957,7 +2957,7 @@ static void test_coop_level_multi_window(void)
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
todo_wine ok(IsWindow(window1), "Window 1 was destroyed.\n");
|
||||
ok(IsWindow(window1), "Window 1 was destroyed.\n");
|
||||
ok(IsWindow(window2), "Window 2 was destroyed.\n");
|
||||
|
||||
IDirectDraw4_Release(ddraw);
|
||||
|
@ -2766,7 +2766,7 @@ static void test_coop_level_multi_window(void)
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
todo_wine ok(IsWindow(window1), "Window 1 was destroyed.\n");
|
||||
ok(IsWindow(window1), "Window 1 was destroyed.\n");
|
||||
ok(IsWindow(window2), "Window 2 was destroyed.\n");
|
||||
|
||||
IDirectDraw7_Release(ddraw);
|
||||
|
Loading…
x
Reference in New Issue
Block a user