Commit 7cdad62b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Improved focus handling.

parent b6765134
......@@ -508,7 +508,6 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
void handle_edit_load(HTMLDocument *This)
{
This->doc_obj->nscontainer->reset_focus = GetFocus();
get_editor_controller(This->doc_obj->nscontainer);
}
......
......@@ -437,8 +437,6 @@ struct NSContainer {
nsIURIContentListener *content_listener;
HWND hwnd;
HWND reset_focus; /* hack */
};
typedef struct nsWineURI nsWineURI;
......
......@@ -80,8 +80,6 @@ static const WCHAR wszNsContainer[] = {'N','s','C','o','n','t','a','i','n','e','
static ATOM nscontainer_class;
#define WM_RESETFOCUS_HACK WM_USER+600
static LRESULT WINAPI nsembed_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
NSContainer *This;
......@@ -106,20 +104,13 @@ static LRESULT WINAPI nsembed_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
WARN("SetSize failed: %08x\n", nsres);
break;
case WM_RESETFOCUS_HACK:
/*
* FIXME
* Gecko grabs focus in edit mode and some apps don't like it.
* We should somehow prevent grabbing focus.
*/
TRACE("WM_RESETFOCUS_HACK\n");
case WM_PARENTNOTIFY:
TRACE("WM_PARENTNOTIFY %x\n", (unsigned)wParam);
if(This->reset_focus) {
SetFocus(This->reset_focus);
This->reset_focus = NULL;
if(This->doc)
This->doc->focus = FALSE;
switch(wParam) {
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
nsIWebBrowserFocus_Activate(This->focus);
}
}
......@@ -1316,9 +1307,6 @@ static nsresult NSAPI nsEmbeddingSiteWindow_SetFocus(nsIEmbeddingSiteWindow *ifa
TRACE("(%p)\n", This);
if(This->reset_focus)
PostMessageW(This->hwnd, WM_RESETFOCUS_HACK, 0, 0);
return nsIBaseWindow_SetFocus(This->window);
}
......
......@@ -129,7 +129,7 @@ static nsresult NSAPI handle_blur(nsIDOMEventListener *iface, nsIDOMEvent *event
return NS_ERROR_FAILURE;
doc_obj = doc->basedoc.doc_obj;
if(!doc_obj->nscontainer->reset_focus && doc_obj->focus && !is_doc_child_focus(doc_obj)) {
if(doc_obj->focus && !is_doc_child_focus(doc_obj)) {
doc_obj->focus = FALSE;
notif_focus(doc_obj);
}
......@@ -148,7 +148,7 @@ static nsresult NSAPI handle_focus(nsIDOMEventListener *iface, nsIDOMEvent *even
return NS_ERROR_FAILURE;
doc_obj = doc->basedoc.doc_obj;
if(!doc_obj->nscontainer->reset_focus && !doc_obj->focus) {
if(!doc_obj->focus) {
doc_obj->focus = TRUE;
notif_focus(doc_obj);
}
......
......@@ -92,7 +92,6 @@ static void activate_gecko(NSContainer *This)
nsIBaseWindow_SetVisibility(This->window, TRUE);
nsIBaseWindow_SetEnabled(This->window, TRUE);
nsIWebBrowserFocus_Activate(This->focus);
}
void update_doc(HTMLDocument *This, DWORD flags)
......@@ -216,6 +215,10 @@ static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
case WM_TIMER:
return on_timer(This);
case WM_SETFOCUS:
TRACE("(%p) WM_SETFOCUS\n", This);
nsIWebBrowserFocus_Activate(This->nscontainer->focus);
break;
case WM_MOUSEACTIVATE:
return MA_ACTIVATE;
}
......@@ -664,6 +667,8 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
This->doc_obj->ui_active = TRUE;
}else {
This->doc_obj->focus = FALSE;
nsIWebBrowserFocus_Deactivate(This->doc_obj->nscontainer->focus);
if(This->doc_obj->ui_active) {
This->doc_obj->ui_active = FALSE;
if(This->doc_obj->ip_window)
......
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