ieframe: Improve setting different client site in OleObject_SetClientSite.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4f6f0f09fd
commit
3fbd56b08e
|
@ -283,7 +283,7 @@ static HRESULT on_silent_change(WebBrowser *This)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static void release_client_site(WebBrowser *This)
|
||||
static void release_client_site(WebBrowser *This, BOOL destroy_win)
|
||||
{
|
||||
release_dochost_client(&This->doc_host);
|
||||
|
||||
|
@ -297,7 +297,7 @@ static void release_client_site(WebBrowser *This)
|
|||
This->client_closed = NULL;
|
||||
}
|
||||
|
||||
if(This->shell_embedding_hwnd) {
|
||||
if(destroy_win && This->shell_embedding_hwnd) {
|
||||
DestroyWindow(This->shell_embedding_hwnd);
|
||||
This->shell_embedding_hwnd = NULL;
|
||||
}
|
||||
|
@ -459,6 +459,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
|
|||
WebBrowser *This = impl_from_IOleObject(iface);
|
||||
IDocHostUIHandler *hostui;
|
||||
IOleCommandTarget *olecmd;
|
||||
BOOL get_olecmd = TRUE;
|
||||
IOleContainer *container;
|
||||
IDispatch *disp;
|
||||
HRESULT hres;
|
||||
|
@ -473,7 +474,14 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
|
|||
if(This->client == pClientSite)
|
||||
return S_OK;
|
||||
|
||||
release_client_site(This);
|
||||
if(This->client && pClientSite) {
|
||||
get_olecmd = FALSE;
|
||||
olecmd = This->doc_host.olecmd;
|
||||
if(olecmd)
|
||||
IOleCommandTarget_AddRef(olecmd);
|
||||
}
|
||||
|
||||
release_client_site(This, !pClientSite);
|
||||
|
||||
if(!pClientSite) {
|
||||
on_commandstate_change(&This->doc_host, CSC_NAVIGATEBACK, FALSE);
|
||||
|
@ -497,6 +505,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
|
|||
if(SUCCEEDED(hres))
|
||||
This->doc_host.hostui = hostui;
|
||||
|
||||
if(get_olecmd) {
|
||||
hres = IOleClientSite_GetContainer(This->client, &container);
|
||||
if(SUCCEEDED(hres)) {
|
||||
ITargetContainer *target_container;
|
||||
|
@ -518,10 +527,24 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
|
|||
if(FAILED(hres))
|
||||
olecmd = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
This->doc_host.olecmd = olecmd;
|
||||
|
||||
if(This->shell_embedding_hwnd) {
|
||||
IOleInPlaceSite *inplace;
|
||||
HWND parent;
|
||||
|
||||
hres = IOleClientSite_QueryInterface(This->client, &IID_IOleInPlaceSite, (void**)&inplace);
|
||||
if(SUCCEEDED(hres)) {
|
||||
hres = IOleInPlaceSite_GetWindow(inplace, &parent);
|
||||
IOleInPlaceSite_Release(inplace);
|
||||
if(SUCCEEDED(hres))
|
||||
SHSetParentHwnd(This->shell_embedding_hwnd, parent);
|
||||
}
|
||||
}else {
|
||||
create_shell_embedding_hwnd(This);
|
||||
}
|
||||
|
||||
on_offlineconnected_change(This);
|
||||
on_silent_change(This);
|
||||
|
@ -1198,5 +1221,5 @@ void WebBrowser_OleObject_Init(WebBrowser *This)
|
|||
|
||||
void WebBrowser_OleObject_Destroy(WebBrowser *This)
|
||||
{
|
||||
release_client_site(This);
|
||||
release_client_site(This, TRUE);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue