mshtml: Improved focus handling.
This commit is contained in:
parent
b6765134a3
commit
7cdad62b97
@ -508,7 +508,6 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
|
|||||||
|
|
||||||
void handle_edit_load(HTMLDocument *This)
|
void handle_edit_load(HTMLDocument *This)
|
||||||
{
|
{
|
||||||
This->doc_obj->nscontainer->reset_focus = GetFocus();
|
|
||||||
get_editor_controller(This->doc_obj->nscontainer);
|
get_editor_controller(This->doc_obj->nscontainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,8 +437,6 @@ struct NSContainer {
|
|||||||
nsIURIContentListener *content_listener;
|
nsIURIContentListener *content_listener;
|
||||||
|
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
|
||||||
HWND reset_focus; /* hack */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct nsWineURI nsWineURI;
|
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;
|
static ATOM nscontainer_class;
|
||||||
|
|
||||||
#define WM_RESETFOCUS_HACK WM_USER+600
|
|
||||||
|
|
||||||
static LRESULT WINAPI nsembed_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI nsembed_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
NSContainer *This;
|
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);
|
WARN("SetSize failed: %08x\n", nsres);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_RESETFOCUS_HACK:
|
case WM_PARENTNOTIFY:
|
||||||
/*
|
TRACE("WM_PARENTNOTIFY %x\n", (unsigned)wParam);
|
||||||
* 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");
|
switch(wParam) {
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
if(This->reset_focus) {
|
case WM_RBUTTONDOWN:
|
||||||
SetFocus(This->reset_focus);
|
nsIWebBrowserFocus_Activate(This->focus);
|
||||||
This->reset_focus = NULL;
|
|
||||||
if(This->doc)
|
|
||||||
This->doc->focus = FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1316,9 +1307,6 @@ static nsresult NSAPI nsEmbeddingSiteWindow_SetFocus(nsIEmbeddingSiteWindow *ifa
|
|||||||
|
|
||||||
TRACE("(%p)\n", This);
|
TRACE("(%p)\n", This);
|
||||||
|
|
||||||
if(This->reset_focus)
|
|
||||||
PostMessageW(This->hwnd, WM_RESETFOCUS_HACK, 0, 0);
|
|
||||||
|
|
||||||
return nsIBaseWindow_SetFocus(This->window);
|
return nsIBaseWindow_SetFocus(This->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ static nsresult NSAPI handle_blur(nsIDOMEventListener *iface, nsIDOMEvent *event
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
doc_obj = doc->basedoc.doc_obj;
|
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;
|
doc_obj->focus = FALSE;
|
||||||
notif_focus(doc_obj);
|
notif_focus(doc_obj);
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ static nsresult NSAPI handle_focus(nsIDOMEventListener *iface, nsIDOMEvent *even
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
doc_obj = doc->basedoc.doc_obj;
|
doc_obj = doc->basedoc.doc_obj;
|
||||||
|
|
||||||
if(!doc_obj->nscontainer->reset_focus && !doc_obj->focus) {
|
if(!doc_obj->focus) {
|
||||||
doc_obj->focus = TRUE;
|
doc_obj->focus = TRUE;
|
||||||
notif_focus(doc_obj);
|
notif_focus(doc_obj);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,6 @@ static void activate_gecko(NSContainer *This)
|
|||||||
|
|
||||||
nsIBaseWindow_SetVisibility(This->window, TRUE);
|
nsIBaseWindow_SetVisibility(This->window, TRUE);
|
||||||
nsIBaseWindow_SetEnabled(This->window, TRUE);
|
nsIBaseWindow_SetEnabled(This->window, TRUE);
|
||||||
nsIWebBrowserFocus_Activate(This->focus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_doc(HTMLDocument *This, DWORD flags)
|
void update_doc(HTMLDocument *This, DWORD flags)
|
||||||
@ -216,6 +215,10 @@ static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
|
|||||||
break;
|
break;
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
return on_timer(This);
|
return on_timer(This);
|
||||||
|
case WM_SETFOCUS:
|
||||||
|
TRACE("(%p) WM_SETFOCUS\n", This);
|
||||||
|
nsIWebBrowserFocus_Activate(This->nscontainer->focus);
|
||||||
|
break;
|
||||||
case WM_MOUSEACTIVATE:
|
case WM_MOUSEACTIVATE:
|
||||||
return MA_ACTIVATE;
|
return MA_ACTIVATE;
|
||||||
}
|
}
|
||||||
@ -664,6 +667,8 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
|
|||||||
|
|
||||||
This->doc_obj->ui_active = TRUE;
|
This->doc_obj->ui_active = TRUE;
|
||||||
}else {
|
}else {
|
||||||
|
This->doc_obj->focus = FALSE;
|
||||||
|
nsIWebBrowserFocus_Deactivate(This->doc_obj->nscontainer->focus);
|
||||||
if(This->doc_obj->ui_active) {
|
if(This->doc_obj->ui_active) {
|
||||||
This->doc_obj->ui_active = FALSE;
|
This->doc_obj->ui_active = FALSE;
|
||||||
if(This->doc_obj->ip_window)
|
if(This->doc_obj->ip_window)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user