Commit 1a7bf2e0 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

shdocvw: Use more flexible mechanism instead of WB_WM_NAVIGATE2.

parent 4ff62118
...@@ -25,6 +25,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); ...@@ -25,6 +25,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
static ATOM doc_view_atom = 0; static ATOM doc_view_atom = 0;
void push_dochost_task(DocHost *This, task_header_t *task, task_proc_t proc, BOOL send)
{
task->proc = proc;
/* FIXME: Don't use lParam */
if(send)
SendMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, (LPARAM)task);
else
PostMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, (LPARAM)task);
}
LRESULT process_dochost_task(DocHost *This, LPARAM lparam)
{
task_header_t *task = (task_header_t*)lparam;
task->proc(This, task);
heap_free(task);
return 0;
}
static void navigate_complete(DocHost *This) static void navigate_complete(DocHost *This)
{ {
IDispatch *disp = NULL; IDispatch *disp = NULL;
...@@ -59,7 +80,7 @@ static void navigate_complete(DocHost *This) ...@@ -59,7 +80,7 @@ static void navigate_complete(DocHost *This)
IDispatch_Release(disp); IDispatch_Release(disp);
} }
static LRESULT navigate2(DocHost *This) void object_available(DocHost *This)
{ {
IHlinkTarget *hlink; IHlinkTarget *hlink;
HRESULT hres; HRESULT hres;
...@@ -68,25 +89,25 @@ static LRESULT navigate2(DocHost *This) ...@@ -68,25 +89,25 @@ static LRESULT navigate2(DocHost *This)
if(!This->document) { if(!This->document) {
WARN("document == NULL\n"); WARN("document == NULL\n");
return 0; return;
} }
hres = IUnknown_QueryInterface(This->document, &IID_IHlinkTarget, (void**)&hlink); hres = IUnknown_QueryInterface(This->document, &IID_IHlinkTarget, (void**)&hlink);
if(FAILED(hres)) { if(FAILED(hres)) {
FIXME("Could not get IHlinkTarget interface\n"); FIXME("Could not get IHlinkTarget interface\n");
return 0; return;
} }
hres = IHlinkTarget_Navigate(hlink, 0, NULL); hres = IHlinkTarget_Navigate(hlink, 0, NULL);
IHlinkTarget_Release(hlink); IHlinkTarget_Release(hlink);
if(FAILED(hres)) { if(FAILED(hres)) {
FIXME("Navigate failed\n"); FIXME("Navigate failed\n");
return 0; return;
} }
navigate_complete(This); navigate_complete(This);
return 0; return;
} }
static LRESULT resize_document(DocHost *This, LONG width, LONG height) static LRESULT resize_document(DocHost *This, LONG width, LONG height)
...@@ -117,8 +138,6 @@ static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l ...@@ -117,8 +138,6 @@ static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
switch(msg) { switch(msg) {
case WM_SIZE: case WM_SIZE:
return resize_document(This, LOWORD(lParam), HIWORD(lParam)); return resize_document(This, LOWORD(lParam), HIWORD(lParam));
case WB_WM_NAVIGATE2:
return navigate2(This);
} }
return DefWindowProcW(hwnd, msg, wParam, lParam); return DefWindowProcW(hwnd, msg, wParam, lParam);
......
...@@ -77,6 +77,8 @@ ie_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) ...@@ -77,6 +77,8 @@ ie_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
return iewnd_OnDestroy(This); return iewnd_OnDestroy(This);
case WM_SIZE: case WM_SIZE:
return iewnd_OnSize(This, LOWORD(lparam), HIWORD(lparam)); return iewnd_OnSize(This, LOWORD(lparam), HIWORD(lparam));
case WM_DOCHOSTTASK:
return process_dochost_task(&This->doc_host, lparam);
} }
return DefWindowProcW(hwnd, msg, wparam, lparam); return DefWindowProcW(hwnd, msg, wparam, lparam);
} }
......
...@@ -269,10 +269,16 @@ static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *if ...@@ -269,10 +269,16 @@ static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *if
return E_NOTIMPL; return E_NOTIMPL;
} }
static void object_available_proc(DocHost *This, task_header_t *task)
{
object_available(This);
}
static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface, static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface,
REFIID riid, IUnknown *punk) REFIID riid, IUnknown *punk)
{ {
BindStatusCallback *This = BINDSC_THIS(iface); BindStatusCallback *This = BINDSC_THIS(iface);
task_header_t *task;
IOleObject *oleobj; IOleObject *oleobj;
HRESULT hres; HRESULT hres;
...@@ -302,7 +308,8 @@ static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback * ...@@ -302,7 +308,8 @@ static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *
/* FIXME: Call SetAdvise */ /* FIXME: Call SetAdvise */
/* FIXME: Call Invoke(DISPID_READYSTATE) */ /* FIXME: Call Invoke(DISPID_READYSTATE) */
PostMessageW(This->doc_host->hwnd, WB_WM_NAVIGATE2, 0, 0); task = heap_alloc(sizeof(*task));
push_dochost_task(This->doc_host, task, object_available_proc, FALSE);
return S_OK; return S_OK;
} }
......
...@@ -61,6 +61,8 @@ static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, L ...@@ -61,6 +61,8 @@ static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, L
switch(msg) { switch(msg) {
case WM_SIZE: case WM_SIZE:
return resize_window(This, LOWORD(lParam), HIWORD(lParam)); return resize_window(This, LOWORD(lParam), HIWORD(lParam));
case WM_DOCHOSTTASK:
return process_dochost_task(&This->doc_host, lParam);
} }
return DefWindowProcW(hwnd, msg, wParam, lParam); return DefWindowProcW(hwnd, msg, wParam, lParam);
......
...@@ -51,6 +51,7 @@ extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid, ...@@ -51,6 +51,7 @@ extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid,
*/ */
typedef struct ConnectionPoint ConnectionPoint; typedef struct ConnectionPoint ConnectionPoint;
typedef struct DocHost DocHost;
typedef struct { typedef struct {
const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl; const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
...@@ -62,7 +63,15 @@ typedef struct { ...@@ -62,7 +63,15 @@ typedef struct {
IUnknown *impl; IUnknown *impl;
} ConnectionPointContainer; } ConnectionPointContainer;
typedef struct { struct _task_header_t;
typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
typedef struct _task_header_t {
task_proc_t proc;
} task_header_t;
struct DocHost {
const IOleClientSiteVtbl *lpOleClientSiteVtbl; const IOleClientSiteVtbl *lpOleClientSiteVtbl;
const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl; const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl;
const IDocHostUIHandler2Vtbl *lpDocHostUIHandlerVtbl; const IDocHostUIHandler2Vtbl *lpDocHostUIHandlerVtbl;
...@@ -92,7 +101,7 @@ typedef struct { ...@@ -92,7 +101,7 @@ typedef struct {
VARIANT_BOOL offline; VARIANT_BOOL offline;
ConnectionPointContainer cps; ConnectionPointContainer cps;
} DocHost; };
struct WebBrowser { struct WebBrowser {
/* Interfaces available via WebBrowser object */ /* Interfaces available via WebBrowser object */
...@@ -198,17 +207,20 @@ HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**); ...@@ -198,17 +207,20 @@ HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
void create_doc_view_hwnd(DocHost*); void create_doc_view_hwnd(DocHost*);
void deactivate_document(DocHost*); void deactivate_document(DocHost*);
void object_available(DocHost*);
void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*); void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*); HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
HRESULT go_home(DocHost*); HRESULT go_home(DocHost*);
#define WM_DOCHOSTTASK (WM_USER+0x300)
void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL);
LRESULT process_dochost_task(DocHost*,LPARAM);
HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**); HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
void InternetExplorer_WebBrowser_Init(InternetExplorer*); void InternetExplorer_WebBrowser_Init(InternetExplorer*);
HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**); HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);
#define WB_WM_NAVIGATE2 (WM_USER+100)
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl))) #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
/********************************************************************** /**********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment