Commit ca8114ff authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ieframe: Added support for OnFocus notifications.

parent 8c7a9077
...@@ -49,6 +49,22 @@ static LRESULT resize_window(WebBrowser *This, LONG width, LONG height) ...@@ -49,6 +49,22 @@ static LRESULT resize_window(WebBrowser *This, LONG width, LONG height)
return 0; return 0;
} }
static void notify_on_focus(WebBrowser *This, BOOL got_focus)
{
IOleControlSite *control_site;
HRESULT hres;
if(!This->client)
return;
hres = IOleClientSite_QueryInterface(This->client, &IID_IOleControlSite, (void**)&control_site);
if(FAILED(hres))
return;
IOleControlSite_OnFocus(control_site, got_focus);
IOleControlSite_Release(control_site);
}
static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
WebBrowser *This; WebBrowser *This;
...@@ -67,6 +83,12 @@ static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, L ...@@ -67,6 +83,12 @@ static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, L
return resize_window(This, LOWORD(lParam), HIWORD(lParam)); return resize_window(This, LOWORD(lParam), HIWORD(lParam));
case WM_DOCHOSTTASK: case WM_DOCHOSTTASK:
return process_dochost_tasks(&This->doc_host); return process_dochost_tasks(&This->doc_host);
case WM_SETFOCUS:
notify_on_focus(This, TRUE);
break;
case WM_KILLFOCUS:
notify_on_focus(This, FALSE);
break;
} }
return DefWindowProcW(hwnd, msg, wParam, lParam); return DefWindowProcW(hwnd, msg, wParam, lParam);
...@@ -203,6 +225,7 @@ static HRESULT activate_ui(WebBrowser *This, IOleClientSite *active_site) ...@@ -203,6 +225,7 @@ static HRESULT activate_ui(WebBrowser *This, IOleClientSite *active_site)
IOleInPlaceFrame_SetMenu(This->doc_host.frame, NULL, NULL, This->shell_embedding_hwnd); IOleInPlaceFrame_SetMenu(This->doc_host.frame, NULL, NULL, This->shell_embedding_hwnd);
SetFocus(This->shell_embedding_hwnd); SetFocus(This->shell_embedding_hwnd);
notify_on_focus(This, TRUE);
return S_OK; return S_OK;
} }
...@@ -534,10 +557,11 @@ static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption) ...@@ -534,10 +557,11 @@ static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
if(This->uiwindow) if(This->uiwindow)
IOleInPlaceUIWindow_SetActiveObject(This->uiwindow, NULL, NULL); IOleInPlaceUIWindow_SetActiveObject(This->uiwindow, NULL, NULL);
if(This->inplace) { if(This->inplace)
IOleInPlaceSiteEx_OnUIDeactivate(This->inplace, FALSE); IOleInPlaceSiteEx_OnUIDeactivate(This->inplace, FALSE);
notify_on_focus(This, FALSE);
if(This->inplace)
IOleInPlaceSiteEx_OnInPlaceDeactivate(This->inplace); IOleInPlaceSiteEx_OnInPlaceDeactivate(This->inplace);
}
return IOleObject_SetClientSite(iface, NULL); return IOleObject_SetClientSite(iface, NULL);
} }
......
...@@ -143,7 +143,8 @@ DEFINE_EXPECT(OnUIDeactivate); ...@@ -143,7 +143,8 @@ DEFINE_EXPECT(OnUIDeactivate);
DEFINE_EXPECT(OnInPlaceDeactivate); DEFINE_EXPECT(OnInPlaceDeactivate);
DEFINE_EXPECT(RequestUIActivate); DEFINE_EXPECT(RequestUIActivate);
DEFINE_EXPECT(ControlSite_TranslateAccelerator); DEFINE_EXPECT(ControlSite_TranslateAccelerator);
DEFINE_EXPECT(OnFocus); DEFINE_EXPECT(OnFocus_TRUE);
DEFINE_EXPECT(OnFocus_FALSE);
DEFINE_EXPECT(GetExternal); DEFINE_EXPECT(GetExternal);
static const WCHAR wszItem[] = {'i','t','e','m',0}; static const WCHAR wszItem[] = {'i','t','e','m',0};
...@@ -1135,7 +1136,10 @@ static HRESULT WINAPI IOleControlSite_fnTranslateAccelerator(IOleControlSite* Th ...@@ -1135,7 +1136,10 @@ static HRESULT WINAPI IOleControlSite_fnTranslateAccelerator(IOleControlSite* Th
static HRESULT WINAPI IOleControlSite_fnOnFocus(IOleControlSite* This, BOOL fGotFocus) static HRESULT WINAPI IOleControlSite_fnOnFocus(IOleControlSite* This, BOOL fGotFocus)
{ {
CHECK_EXPECT2(OnFocus); if(fGotFocus)
CHECK_EXPECT2(OnFocus_TRUE);
else
CHECK_EXPECT2(OnFocus_FALSE);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -1813,7 +1817,7 @@ static void test_DoVerb(IWebBrowser2 *unk) ...@@ -1813,7 +1817,7 @@ static void test_DoVerb(IWebBrowser2 *unk)
SET_EXPECT(Frame_SetActiveObject); SET_EXPECT(Frame_SetActiveObject);
SET_EXPECT(UIWindow_SetActiveObject); SET_EXPECT(UIWindow_SetActiveObject);
SET_EXPECT(SetMenu); SET_EXPECT(SetMenu);
SET_EXPECT(OnFocus); SET_EXPECT(OnFocus_TRUE);
hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite,
0, (HWND)0xdeadbeef, &rect); 0, (HWND)0xdeadbeef, &rect);
...@@ -1830,7 +1834,7 @@ static void test_DoVerb(IWebBrowser2 *unk) ...@@ -1830,7 +1834,7 @@ static void test_DoVerb(IWebBrowser2 *unk)
CHECK_CALLED(Frame_SetActiveObject); CHECK_CALLED(Frame_SetActiveObject);
CHECK_CALLED(UIWindow_SetActiveObject); CHECK_CALLED(UIWindow_SetActiveObject);
CHECK_CALLED(SetMenu); CHECK_CALLED(SetMenu);
todo_wine CHECK_CALLED(OnFocus); CHECK_CALLED(OnFocus_TRUE);
hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite,
0, (HWND)0xdeadbeef, &rect); 0, (HWND)0xdeadbeef, &rect);
...@@ -3213,7 +3217,7 @@ static void test_UIActivate(IWebBrowser2 *unk, BOOL activate) ...@@ -3213,7 +3217,7 @@ static void test_UIActivate(IWebBrowser2 *unk, BOOL activate)
SET_EXPECT(RequestUIActivate); SET_EXPECT(RequestUIActivate);
SET_EXPECT(ShowUI); SET_EXPECT(ShowUI);
SET_EXPECT(HideUI); SET_EXPECT(HideUI);
SET_EXPECT(OnFocus); SET_EXPECT(OnFocus_FALSE);
} }
hres = IOleDocumentView_UIActivate(docview, activate); hres = IOleDocumentView_UIActivate(docview, activate);
...@@ -3227,7 +3231,7 @@ static void test_UIActivate(IWebBrowser2 *unk, BOOL activate) ...@@ -3227,7 +3231,7 @@ static void test_UIActivate(IWebBrowser2 *unk, BOOL activate)
CHECK_CALLED(RequestUIActivate); CHECK_CALLED(RequestUIActivate);
CHECK_CALLED(ShowUI); CHECK_CALLED(ShowUI);
CHECK_CALLED(HideUI); CHECK_CALLED(HideUI);
CHECK_CALLED(OnFocus); CHECK_CALLED(OnFocus_FALSE);
} }
} }
...@@ -3490,7 +3494,7 @@ static void test_Close(IWebBrowser2 *wb, BOOL do_download) ...@@ -3490,7 +3494,7 @@ static void test_Close(IWebBrowser2 *wb, BOOL do_download)
SET_EXPECT(Frame_SetActiveObject); SET_EXPECT(Frame_SetActiveObject);
SET_EXPECT(UIWindow_SetActiveObject); SET_EXPECT(UIWindow_SetActiveObject);
SET_EXPECT(OnUIDeactivate); SET_EXPECT(OnUIDeactivate);
SET_EXPECT(OnFocus); SET_EXPECT(OnFocus_FALSE);
SET_EXPECT(OnInPlaceDeactivate); SET_EXPECT(OnInPlaceDeactivate);
SET_EXPECT(Invoke_STATUSTEXTCHANGE); SET_EXPECT(Invoke_STATUSTEXTCHANGE);
if(!do_download) { if(!do_download) {
...@@ -3513,7 +3517,7 @@ static void test_Close(IWebBrowser2 *wb, BOOL do_download) ...@@ -3513,7 +3517,7 @@ static void test_Close(IWebBrowser2 *wb, BOOL do_download)
CHECK_CALLED(Frame_SetActiveObject); CHECK_CALLED(Frame_SetActiveObject);
CHECK_CALLED(UIWindow_SetActiveObject); CHECK_CALLED(UIWindow_SetActiveObject);
CHECK_CALLED(OnUIDeactivate); CHECK_CALLED(OnUIDeactivate);
todo_wine CHECK_CALLED(OnFocus); CHECK_CALLED(OnFocus_FALSE);
CHECK_CALLED(OnInPlaceDeactivate); CHECK_CALLED(OnInPlaceDeactivate);
CLEAR_CALLED(Invoke_STATUSTEXTCHANGE); /* Called by IE9 */ CLEAR_CALLED(Invoke_STATUSTEXTCHANGE); /* Called by IE9 */
if(!do_download) { if(!do_download) {
......
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