wine/dlls/shdocvw dochost.c oleobject.c shdocv ...

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 28 05:04:43 CST 2005


ChangeSet ID:	21479
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/28 05:04:42

Modified files:
	dlls/shdocvw   : dochost.c oleobject.c shdocvw.h webbrowser.c 

Log message:
	Jacek Caban <jacek at codeweavers.com>
	Better windows handling.

Patch: http://cvs.winehq.org/patch.py?id=21479

Old revision  New revision  Changes     Path
 1.2           1.3           +52 -0      wine/dlls/shdocvw/dochost.c
 1.19          1.20          +9 -36      wine/dlls/shdocvw/oleobject.c
 1.33          1.34          +2 -0       wine/dlls/shdocvw/shdocvw.h
 1.27          1.28          +3 -0       wine/dlls/shdocvw/webbrowser.c

Index: wine/dlls/shdocvw/dochost.c
diff -u -p wine/dlls/shdocvw/dochost.c:1.2 wine/dlls/shdocvw/dochost.c:1.3
--- wine/dlls/shdocvw/dochost.c:1.2	28 Nov 2005 11: 4:42 -0000
+++ wine/dlls/shdocvw/dochost.c	28 Nov 2005 11: 4:42 -0000
@@ -21,6 +21,56 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
 
+static ATOM doc_view_atom = 0;
+
+static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    WebBrowser *This;
+
+    static const WCHAR wszTHIS[] = {'T','H','I','S',0};
+
+    if(msg == WM_CREATE) {
+        This = *(WebBrowser**)lParam;
+        ERR("create %p\n", This);
+        SetPropW(hwnd, wszTHIS, This);
+    }else {
+        This = GetPropW(hwnd, wszTHIS);
+    }
+
+    return DefWindowProcA(hwnd, msg, wParam, lParam);
+}
+
+void create_doc_view_hwnd(WebBrowser *This)
+{
+    RECT rect;
+
+    static const WCHAR wszShell_DocObject_View[] =
+        {'S','h','e','l','l',' ','D','o','c','O','b','j','e','c','t',' ','V','i','e','w',0};
+
+    if(!doc_view_atom) {
+        static WNDCLASSEXW wndclass = {
+            sizeof(wndclass),
+            CS_PARENTDC,
+            doc_view_proc,
+            0, 0 /* native uses 4*/, NULL, NULL, NULL,
+            (HBRUSH)COLOR_WINDOWFRAME, NULL,
+            wszShell_DocObject_View,
+            NULL
+        };
+
+        wndclass.hInstance = shdocvw_hinstance;
+
+        doc_view_atom = RegisterClassExW(&wndclass);
+    }
+
+    GetWindowRect(This->shell_embedding_hwnd, &rect);
+    This->doc_view_hwnd = CreateWindowExW(0, wszShell_DocObject_View,
+         wszShell_DocObject_View,
+         WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP | WS_MAXIMIZEBOX,
+         rect.left, rect.top, rect.right, rect.bottom, This->shell_embedding_hwnd,
+         NULL, shdocvw_hinstance, This);
+}
+
 #define DOCHOSTUI_THIS(iface) DEFINE_THIS(WebBrowser, DocHostUIHandler, iface)
 
 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface,
@@ -214,4 +264,6 @@ static const IDocHostUIHandler2Vtbl DocH
 void WebBrowser_DocHost_Init(WebBrowser *This)
 {
     This->lpDocHostUIHandlerVtbl = &DocHostUIHandler2Vtbl;
+
+    This->doc_view_hwnd = NULL;
 }
Index: wine/dlls/shdocvw/oleobject.c
diff -u -p wine/dlls/shdocvw/oleobject.c:1.19 wine/dlls/shdocvw/oleobject.c:1.20
--- wine/dlls/shdocvw/oleobject.c:1.19	28 Nov 2005 11: 4:42 -0000
+++ wine/dlls/shdocvw/oleobject.c	28 Nov 2005 11: 4:42 -0000
@@ -29,46 +29,13 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
 
-static ATOM doc_view_atom = 0;
 static ATOM shell_embedding_atom = 0;
 
-static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-    return DefWindowProcA(hwnd, msg, wParam, lParam);
-}
-
 static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     return DefWindowProcA(hwnd, msg, wParam, lParam);
 }
 
-static void create_doc_view_hwnd(WebBrowser *This)
-{
-    static const WCHAR wszShell_DocObject_View[] =
-        {'S','h','e','l','l',' ','D','o','c','O','b','j','e','c','t',' ','V','i','e','w',0};
-
-    if(!doc_view_atom) {
-        static WNDCLASSEXW wndclass = {
-            sizeof(wndclass),
-            CS_PARENTDC,
-            doc_view_proc,
-            0, 0 /* native uses 4*/, NULL, NULL, NULL,
-            (HBRUSH)COLOR_WINDOWFRAME, NULL,
-            wszShell_DocObject_View,
-            NULL
-        };
-
-        wndclass.hInstance = shdocvw_hinstance;
-
-        doc_view_atom = RegisterClassExW(&wndclass);
-    }
-
-    This->doc_view_hwnd = CreateWindowExW(0, wszShell_DocObject_View, NULL,
-         WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP | WS_MAXIMIZEBOX,
-         0, 0, 0, 0, This->shell_embedding_hwnd,
-         NULL, shdocvw_hinstance, This);
-}
-
 static void create_shell_embedding_hwnd(WebBrowser *This)
 {
     IOleInPlaceSite *inplace;
@@ -99,12 +66,10 @@ static void create_shell_embedding_hwnd(
         IOleInPlaceSite_Release(inplace);
     }
 
-    This->shell_embedding_hwnd = CreateWindowExW(0, wszShellEmbedding, NULL,
+    This->shell_embedding_hwnd = CreateWindowExW(0, wszShellEmbedding, wszShellEmbedding,
          WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP | WS_MAXIMIZEBOX,
          0, 0, 0, 0, parent,
          NULL, shdocvw_hinstance, This);
-
-    create_doc_view_hwnd(This);
 }
 
 /**********************************************************************
@@ -266,6 +231,13 @@ static HRESULT WINAPI OleObject_DoVerb(I
 
         IOleInPlaceSite_Release(inplace);
 
+        SetWindowPos(This->shell_embedding_hwnd, NULL,
+                     This->pos_rect.left, This->pos_rect.top,
+                     This->pos_rect.right-This->pos_rect.left,
+                     This->pos_rect.bottom-This->pos_rect.top,
+                     SWP_NOZORDER | SWP_SHOWWINDOW);
+
+
         if(This->client) {
             IOleClientSite_ShowObject(This->client);
             IOleClientSite_GetContainer(This->client, &This->container);
@@ -586,6 +558,7 @@ void WebBrowser_OleObject_Init(WebBrowse
     This->frame_hwnd = NULL;
     This->frame = NULL;
     This->uiwindow = NULL;
+    This->shell_embedding_hwnd = NULL;
 
     memset(&This->pos_rect, 0, sizeof(RECT));
     memset(&This->clip_rect, 0, sizeof(RECT));
Index: wine/dlls/shdocvw/shdocvw.h
diff -u -p wine/dlls/shdocvw/shdocvw.h:1.33 wine/dlls/shdocvw/shdocvw.h:1.34
--- wine/dlls/shdocvw/shdocvw.h:1.33	28 Nov 2005 11: 4:42 -0000
+++ wine/dlls/shdocvw/shdocvw.h	28 Nov 2005 11: 4:42 -0000
@@ -146,6 +146,8 @@ void WebBrowser_Events_Destroy(WebBrowse
 
 HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
 
+void create_doc_view_hwnd(WebBrowser *This);
+
 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
 
 /**********************************************************************
Index: wine/dlls/shdocvw/webbrowser.c
diff -u -p wine/dlls/shdocvw/webbrowser.c:1.27 wine/dlls/shdocvw/webbrowser.c:1.28
--- wine/dlls/shdocvw/webbrowser.c:1.27	28 Nov 2005 11: 4:43 -0000
+++ wine/dlls/shdocvw/webbrowser.c	28 Nov 2005 11: 4:43 -0000
@@ -515,6 +515,9 @@ static HRESULT WINAPI WebBrowser_Navigat
     if(V_VT(URL) != VT_BSTR)
         return E_INVALIDARG;
 
+    if(!This->doc_view_hwnd)
+        create_doc_view_hwnd(This);
+
     /*
      * FIXME:
      * We should use URLMoniker's BindToObject instead creating HTMLDocument here.



More information about the wine-cvs mailing list