1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-23 20:05:53 +01:00

Go to irritating lengths to keep the hidden location bar from stealing keyboard focus. Closes issue #292.

This commit is contained in:
Kris Maglione
2011-01-22 10:12:44 -05:00
parent f33ae2b044
commit c10e05bbe4
2 changed files with 11 additions and 3 deletions

View File

@@ -1245,7 +1245,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
if (error.result == Cr.NS_BINDING_ABORTED) if (error.result == Cr.NS_BINDING_ABORTED)
return; return;
if (echo) if (echo)
dactyl.echoerr(error); dactyl.echoerr(error, commandline.FORCE_SINGLELINE);
util.reportError(error); util.reportError(error);
}, },

View File

@@ -143,9 +143,10 @@ var Events = Module("events", {
catch (e) { catch (e) {
dactyl.reportError(e); dactyl.reportError(e);
if (e.message == "Interrupted") if (e.message == "Interrupted")
dactyl.echoerr("Interrupted"); dactyl.echoerr("Interrupted", commandline.FORCE_SINGLELINE);
else else
dactyl.echoerr("Processing " + event.type + " event: " + (e.echoerr || e)); dactyl.echoerr("Processing " + event.type + " event: " + (e.echoerr || e),
commandline.FORCE_SINGLELINE);
} }
}; };
return wrappedListener; return wrappedListener;
@@ -739,6 +740,13 @@ var Events = Module("events", {
if (elem instanceof Element) { if (elem instanceof Element) {
let win = elem.ownerDocument.defaultView; let win = elem.ownerDocument.defaultView;
if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
for (let e = elem; e; e = e.parentNode)
if (util.computedStyle(e).visibility !== "visible") {
elem.blur();
break;
}
if (events.isContentNode(elem) && !buffer.focusAllowed(elem) if (events.isContentNode(elem) && !buffer.focusAllowed(elem)
&& !(services.focus.getLastFocusMethod(win) & 0x7000) && !(services.focus.getLastFocusMethod(win) & 0x7000)
&& isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) { && isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {