Henri Verbeet : wined3d: Do not acquire/ release the focus window in wined3d_swapchain_set_fullscreen().

Alexandre Julliard julliard at winehq.org
Wed Jun 19 15:08:16 CDT 2019


Module: wine
Branch: master
Commit: b94a6b1efd22e4095a131776790c7f2280dfb5a8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b94a6b1efd22e4095a131776790c7f2280dfb5a8

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Jun 19 14:59:03 2019 +0430

wined3d: Do not acquire/release the focus window in wined3d_swapchain_set_fullscreen().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dxgi/tests/dxgi.c   |  2 --
 dlls/wined3d/device.c    | 25 +++++++++++++++++++++----
 dlls/wined3d/swapchain.c | 10 ----------
 3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index c5e5006..d058122 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -4685,7 +4685,6 @@ static void test_swapchain_window_messages(void)
     hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
     ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
     flush_events();
-    todo_wine
     ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
     expect_messages = NULL;
 
@@ -4717,7 +4716,6 @@ static void test_swapchain_window_messages(void)
     hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
     ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
     flush_events();
-    todo_wine
     ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
     expect_messages = NULL;
 
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 897e2f6..09e3da3 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5405,7 +5405,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
     struct wined3d_rendertarget_view *view;
     struct wined3d_swapchain *swapchain;
     struct wined3d_view_desc view_desc;
-    BOOL backbuffer_resized;
+    BOOL backbuffer_resized, windowed;
     HRESULT hr = WINED3D_OK;
     unsigned int i;
 
@@ -5496,13 +5496,30 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
 
     backbuffer_resized = swapchain_desc->backbuffer_width != swapchain->desc.backbuffer_width
             || swapchain_desc->backbuffer_height != swapchain->desc.backbuffer_height;
+    windowed = swapchain->desc.windowed;
 
-    if (!swapchain_desc->windowed != !swapchain->desc.windowed
-            || swapchain->reapply_mode || mode
-            || (!swapchain_desc->windowed && backbuffer_resized))
+    if (!swapchain_desc->windowed != !windowed || swapchain->reapply_mode
+            || mode || (!swapchain_desc->windowed && backbuffer_resized))
     {
+        /* Switch from windowed to fullscreen. */
+        if (windowed && !swapchain_desc->windowed)
+        {
+            HWND focus_window = device->create_parms.focus_window;
+
+            if (!focus_window)
+                focus_window = swapchain->device_window;
+            if (FAILED(hr = wined3d_device_acquire_focus_window(device, focus_window)))
+            {
+                ERR("Failed to acquire focus window, hr %#x.\n", hr);
+                return hr;
+            }
+        }
         if (FAILED(hr = wined3d_swapchain_set_fullscreen(swapchain, swapchain_desc, mode)))
             return hr;
+
+        /* Switch from fullscreen to windowed. */
+        if (!windowed && swapchain_desc->windowed)
+            wined3d_device_release_focus_window(device);
     }
     else if (!swapchain_desc->windowed)
     {
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index dd9ec12..e4882bd 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1474,15 +1474,6 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
         if (swapchain->desc.windowed)
         {
             /* Switch from windowed to fullscreen */
-            HWND focus_window = device->create_parms.focus_window;
-            if (!focus_window)
-                focus_window = swapchain->device_window;
-            if (FAILED(hr = wined3d_device_acquire_focus_window(device, focus_window)))
-            {
-                ERR("Failed to acquire focus window, hr %#x.\n", hr);
-                return hr;
-            }
-
             wined3d_device_setup_fullscreen_window(device, swapchain->device_window, width, height);
         }
         else
@@ -1505,7 +1496,6 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
         if (swapchain->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
             window_rect = &swapchain->original_window_rect;
         wined3d_device_restore_fullscreen_window(device, swapchain->device_window, window_rect);
-        wined3d_device_release_focus_window(device);
     }
 
     swapchain->desc.windowed = swapchain_desc->windowed;




More information about the wine-cvs mailing list