From c2c32fe773aacfdcf823e6faf4a2327e6f997760 Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Sun, 25 Jul 2010 17:04:12 +0200 Subject: [PATCH] dshowvideosink: close our own window when changing the window id If we created the window, it needs to be closed after setting a new window id. https://bugzilla.gnome.org/show_bug.cgi?id=574290 --- sys/dshowvideosink/dshowvideosink.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/dshowvideosink/dshowvideosink.cpp b/sys/dshowvideosink/dshowvideosink.cpp index bfc1c2576a..1e4f219cd2 100644 --- a/sys/dshowvideosink/dshowvideosink.cpp +++ b/sys/dshowvideosink/dshowvideosink.cpp @@ -123,9 +123,16 @@ gst_dshowvideosink_set_window_id (GstXOverlay * overlay, ULONG window_id) if (sink->connected && sink->filter_media_event) { HRESULT hres; - /* Return control of application window */ - SetWindowLongPtr (previous_window, GWL_WNDPROC, (LONG)sink->prevWndProc); - SetWindowPos (previous_window, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + if (sink->is_new_window) { + /* If we created a new window */ + SendMessage (previous_window, WM_CLOSE, NULL, NULL); + sink->is_new_window = FALSE; + sink->window_closed = FALSE; + } else { + /* Return control of application window */ + SetWindowLongPtr (previous_window, GWL_WNDPROC, (LONG)sink->prevWndProc); + SetWindowPos (previous_window, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + } gst_dshowvideosink_set_window_for_renderer (sink);