Aric Stewart : quartz: Allow for proper setting of the video window to WS_CHILD.

Alexandre Julliard julliard at winehq.org
Fri Sep 24 11:43:46 CDT 2010


Module: wine
Branch: master
Commit: 97343b0f002902c0495969f25e48ace8983bf692
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=97343b0f002902c0495969f25e48ace8983bf692

Author: Aric Stewart <aric at codeweavers.com>
Date:   Fri Sep 24 08:53:14 2010 -0500

quartz: Allow for proper setting of the video window to WS_CHILD.

If the set_WindowStyle comes before the set_Owner then the style was not 
being set properly (WS_CHILD cannot be set on a window with a NULL 
parent). So reset the window style when the set_Owner command comes in 
to make the new style allowable.

---

 dlls/quartz/videorenderer.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c
index 0af8cc6..d3ccede 100644
--- a/dlls/quartz/videorenderer.c
+++ b/dlls/quartz/videorenderer.c
@@ -89,6 +89,7 @@ typedef struct VideoRendererImpl
     BOOL bAggregatable;
     REFERENCE_TIME rtLastStop;
     MediaSeekingImpl mediaSeeking;
+    LONG WindowStyle;
 
     /* During pause we can hold a single sample, for use in GetCurrentImage */
     IMediaSample *sample_held;
@@ -611,6 +612,7 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
     ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT));
     ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT));
     pVideoRenderer->hWndMsgDrain = NULL;
+    pVideoRenderer->WindowStyle = WS_OVERLAPPED;
 
     /* construct input pin */
     piInput.dir = PINDIR_INPUT;
@@ -1782,8 +1784,10 @@ static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
 
     if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
         return E_INVALIDARG;
-    
+
     SetWindowLongA(This->hWnd, GWL_STYLE, WindowStyle);
+    SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
+    This->WindowStyle = WindowStyle;
 
     return S_OK;
 }
@@ -1794,7 +1798,7 @@ static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
 
     TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
 
-    *WindowStyle = GetWindowLongA(This->hWnd, GWL_STYLE);
+    *WindowStyle = This->WindowStyle;
 
     return S_OK;
 }
@@ -2013,6 +2017,15 @@ static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
     TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
 
     SetParent(This->hWnd, (HWND)Owner);
+    if (This->WindowStyle & WS_CHILD)
+    {
+        LONG old = GetWindowLongA(This->hWnd, GWL_STYLE);
+        if (old != This->WindowStyle)
+        {
+            SetWindowLongA(This->hWnd, GWL_STYLE, This->WindowStyle);
+            SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
+        }
+    }
 
     return S_OK;
 }




More information about the wine-cvs mailing list