static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface) { HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface); TRACE("(%p)\n", This); if(This->doc_obj->ui_active) IOleDocumentView_UIActivate(&This->IOleDocumentView_iface, FALSE); This->doc_obj->window_active = FALSE; if(!This->doc_obj->in_place_active) return S_OK; if(This->doc_obj->frame) { IOleInPlaceFrame_Release(This->doc_obj->frame); This->doc_obj->frame = NULL; } if(This->doc_obj->hwnd) { ShowWindow(This->doc_obj->hwnd, SW_HIDE); SetWindowPos(This->doc_obj->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); } This->doc_obj->focus = FALSE; notif_focus(This->doc_obj); This->doc_obj->in_place_active = FALSE; if(This->doc_obj->ipsite) { IOleInPlaceSiteEx *ipsiteex; HRESULT hres; hres = IOleInPlaceSite_QueryInterface(This->doc_obj->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex); if(SUCCEEDED(hres)) { IOleInPlaceSiteEx_OnInPlaceDeactivateEx(ipsiteex, TRUE); IOleInPlaceSiteEx_Release(ipsiteex); }else { IOleInPlaceSite_OnInPlaceDeactivate(This->doc_obj->ipsite); } } return S_OK; }
static HRESULT activate_window(HTMLDocumentObj *This) { IOleInPlaceFrame *pIPFrame; IOleCommandTarget *cmdtrg; IOleInPlaceSiteEx *ipsiteex; RECT posrect, cliprect; OLEINPLACEFRAMEINFO frameinfo; HWND parent_hwnd; HRESULT hres; if(!serverwnd_class) register_serverwnd_class(); hres = IOleInPlaceSite_CanInPlaceActivate(This->ipsite); if(hres != S_OK) { WARN("CanInPlaceActivate returned: %08x\n", hres); return FAILED(hres) ? hres : E_FAIL; } hres = IOleInPlaceSite_GetWindowContext(This->ipsite, &pIPFrame, &This->ip_window, &posrect, &cliprect, &frameinfo); if(FAILED(hres)) { WARN("GetWindowContext failed: %08x\n", hres); return hres; } TRACE("got window context: %p %p {%d %d %d %d} {%d %d %d %d} {%d %x %p %p %d}\n", pIPFrame, This->ip_window, posrect.left, posrect.top, posrect.right, posrect.bottom, cliprect.left, cliprect.top, cliprect.right, cliprect.bottom, frameinfo.cb, frameinfo.fMDIApp, frameinfo.hwndFrame, frameinfo.haccel, frameinfo.cAccelEntries); hres = IOleInPlaceSite_GetWindow(This->ipsite, &parent_hwnd); if(FAILED(hres)) { WARN("GetWindow failed: %08x\n", hres); return hres; } TRACE("got parent window %p\n", parent_hwnd); if(This->hwnd) { if(GetParent(This->hwnd) != parent_hwnd) SetParent(This->hwnd, parent_hwnd); SetWindowPos(This->hwnd, HWND_TOP, posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top, SWP_NOACTIVATE | SWP_SHOWWINDOW); }else { CreateWindowExW(0, wszInternetExplorer_Server, NULL, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top, parent_hwnd, NULL, hInst, This); TRACE("Created window %p\n", This->hwnd); SetWindowPos(This->hwnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_SHOWWINDOW); RedrawWindow(This->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN); /* NOTE: * Windows implementation calls: * RegisterWindowMessage("MSWHEEL_ROLLMSG"); */ SetTimer(This->hwnd, TIMER_ID, 100, NULL); } if(This->nscontainer) activate_gecko(This->nscontainer); This->in_place_active = TRUE; hres = IOleInPlaceSite_QueryInterface(This->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex); if(SUCCEEDED(hres)) { BOOL redraw = FALSE; hres = IOleInPlaceSiteEx_OnInPlaceActivateEx(ipsiteex, &redraw, 0); IOleInPlaceSiteEx_Release(ipsiteex); if(redraw) FIXME("unsupported redraw\n"); }else{ hres = IOleInPlaceSite_OnInPlaceActivate(This->ipsite); } if(FAILED(hres)) { WARN("OnInPlaceActivate failed: %08x\n", hres); This->in_place_active = FALSE; return hres; } hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&cmdtrg); if(SUCCEEDED(hres)) { VARIANT var; IOleInPlaceFrame_SetStatusText(pIPFrame, NULL); V_VT(&var) = VT_I4; V_I4(&var) = 0; IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSMAX, OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL); IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS, OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL); IOleCommandTarget_Release(cmdtrg); } if(This->frame) IOleInPlaceFrame_Release(This->frame); This->frame = pIPFrame; if(!This->request_uiactivate) { hres = IOleInPlaceSite_QueryInterface(This->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex); if(SUCCEEDED(hres)) { IOleInPlaceSiteEx_RequestUIActivate(ipsiteex); IOleInPlaceSiteEx_Release(ipsiteex); } } This->window_active = TRUE; return S_OK; }