mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-31 10:55:46 +01:00
Don't fight stuff for focus. Maybe closes #982.
This commit is contained in:
@@ -188,6 +188,11 @@ var Events = Module("events", {
|
||||
|
||||
this.listen(window, this, "events", true);
|
||||
this.listen(window, this.popups, "events", true);
|
||||
|
||||
this.grabFocus = 0;
|
||||
this.grabFocusTimer = Timer(100, 10000, () => {
|
||||
this.grabFocus = 0;
|
||||
});
|
||||
},
|
||||
|
||||
cleanup: function cleanup() {
|
||||
@@ -616,11 +621,15 @@ var Events = Module("events", {
|
||||
Ci.nsIDOMHTMLSelectElement,
|
||||
Ci.nsIDOMHTMLTextAreaElement,
|
||||
Ci.nsIDOMWindow])) {
|
||||
|
||||
if (elem.frameElement)
|
||||
dactyl.focusContent(true);
|
||||
else if (!(elem instanceof Window) || Editor.getEditor(elem))
|
||||
dactyl.focus(window);
|
||||
if (this.grabFocus++ > 5)
|
||||
; // Something is fighting us. Give up.
|
||||
else {
|
||||
this.grabFocusTimer.tell();
|
||||
if (elem.frameElement)
|
||||
dactyl.focusContent(true);
|
||||
else if (!(elem instanceof Window) || Editor.getEditor(elem))
|
||||
dactyl.focus(window);
|
||||
}
|
||||
}
|
||||
|
||||
if (elem instanceof Element)
|
||||
|
||||
Reference in New Issue
Block a user