Akihiro Sagawa : quartz: Hide video window on WM_CLOSE.

Alexandre Julliard julliard at winehq.org
Mon Jun 7 16:30:35 CDT 2021


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

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Wed Jun  2 23:07:58 2021 +0900

quartz: Hide video window on WM_CLOSE.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/tests/videorenderer.c |  4 ++--
 dlls/quartz/tests/vmr7.c          |  4 ++--
 dlls/quartz/tests/vmr9.c          |  4 ++--
 dlls/quartz/window.c              | 10 +++++++++-
 4 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c
index 0df8c9fa738..c1a2e882dc9 100644
--- a/dlls/quartz/tests/videorenderer.c
+++ b/dlls/quartz/tests/videorenderer.c
@@ -1346,7 +1346,7 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     ret = check_ec_userabort(eventsrc, 0);
     todo_wine ok(ret == 1, "Expected EC_USERABORT.\n");
 
-    todo_wine ok(IsWindow(hwnd), "Window should exist.\n");
+    ok(IsWindow(hwnd), "Window should exist.\n");
     ok(!IsWindowVisible(hwnd), "Window should be visible.\n");
 
     thread = send_frame(input);
@@ -1385,7 +1385,7 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     ret = check_ec_userabort(eventsrc, 0);
     todo_wine ok(ret == 1, "Expected EC_USERABORT.\n");
 
-    todo_wine ok(IsWindow(hwnd), "Window should exist.\n");
+    ok(IsWindow(hwnd), "Window should exist.\n");
     ok(!IsWindowVisible(hwnd), "Window should be visible.\n");
 
     hr = IMediaControl_Stop(control);
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c
index 4673601a40b..b8af2163099 100644
--- a/dlls/quartz/tests/vmr7.c
+++ b/dlls/quartz/tests/vmr7.c
@@ -1377,7 +1377,7 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     ret = check_ec_userabort(eventsrc, 0);
     todo_wine ok(ret == 1, "Expected EC_USERABORT.\n");
 
-    todo_wine ok(IsWindow(hwnd), "Window should exist.\n");
+    ok(IsWindow(hwnd), "Window should exist.\n");
     ok(!IsWindowVisible(hwnd), "Window should be visible.\n");
 
     thread = send_frame(input);
@@ -1417,7 +1417,7 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     ret = check_ec_userabort(eventsrc, 0);
     todo_wine ok(ret == 1, "Expected EC_USERABORT.\n");
 
-    todo_wine ok(IsWindow(hwnd), "Window should exist.\n");
+    ok(IsWindow(hwnd), "Window should exist.\n");
     ok(!IsWindowVisible(hwnd), "Window should be visible.\n");
 
     hr = IMediaControl_Stop(control);
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
index 6c863a15a29..3f6982dfb5a 100644
--- a/dlls/quartz/tests/vmr9.c
+++ b/dlls/quartz/tests/vmr9.c
@@ -1582,7 +1582,7 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     ret = check_ec_userabort(eventsrc, 0);
     todo_wine ok(ret == 1, "Expected EC_USERABORT.\n");
 
-    todo_wine ok(IsWindow(hwnd), "Window should exist.\n");
+    ok(IsWindow(hwnd), "Window should exist.\n");
     ok(!IsWindowVisible(hwnd), "Window should be visible.\n");
 
     thread = send_frame(input);
@@ -1622,7 +1622,7 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     ret = check_ec_userabort(eventsrc, 0);
     todo_wine ok(ret == 1, "Expected EC_USERABORT.\n");
 
-    todo_wine ok(IsWindow(hwnd), "Window should exist.\n");
+    ok(IsWindow(hwnd), "Window should exist.\n");
     ok(!IsWindowVisible(hwnd), "Window should be visible.\n");
 
     hr = IMediaControl_Stop(control);
diff --git a/dlls/quartz/window.c b/dlls/quartz/window.c
index 3983d43b08f..94210e043c7 100644
--- a/dlls/quartz/window.c
+++ b/dlls/quartz/window.c
@@ -20,6 +20,8 @@
 
 #include "quartz_private.h"
 
+#define WM_QUARTZ_DESTROY (WM_USER + WM_DESTROY)
+
 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
 
 static const WCHAR class_name[] = L"wine_quartz_window";
@@ -71,6 +73,12 @@ static LRESULT CALLBACK WndProcW(HWND hwnd, UINT message, WPARAM wparam, LPARAM
         if (window->default_dst)
             GetClientRect(window->hwnd, &window->dst);
         break;
+    case WM_QUARTZ_DESTROY:
+        DestroyWindow(hwnd);
+        return 0;
+    case WM_CLOSE:
+        IVideoWindow_put_Visible(&window->IVideoWindow_iface, OAFALSE);
+        return 0;
     }
 
     return DefWindowProcW(hwnd, message, wparam, lparam);
@@ -1251,7 +1259,7 @@ void video_window_cleanup(struct video_window *window)
          * it would become top-level for a brief period before being destroyed. */
         SetWindowLongW(window->hwnd, GWL_STYLE, GetWindowLongW(window->hwnd, GWL_STYLE) & ~WS_CHILD);
 
-        SendMessageW(window->hwnd, WM_CLOSE, 0, 0);
+        SendMessageW(window->hwnd, WM_QUARTZ_DESTROY, 0, 0);
         window->hwnd = NULL;
     }
 }




More information about the wine-cvs mailing list