1
0
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:
Kris Maglione
2014-03-13 21:03:22 -07:00
parent 244434bd64
commit cb11523659
4 changed files with 27 additions and 13 deletions

View File

@@ -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)