mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 18:07:58 +01:00
Don't fight stuff for focus. Maybe closes #982.
This commit is contained in:
7
common/bootstrap.js
vendored
7
common/bootstrap.js
vendored
@@ -178,9 +178,11 @@ let JSMLoader = {
|
|||||||
// Cuts down on stupid, fscking url mangling.
|
// Cuts down on stupid, fscking url mangling.
|
||||||
get loadSubScript() bootstrap_jsm.loadSubScript,
|
get loadSubScript() bootstrap_jsm.loadSubScript,
|
||||||
|
|
||||||
cleanup: function unregister() {
|
cleanup: function cleanup() {
|
||||||
for each (let factory in this.factories.splice(0))
|
for (let factory of this.factories.splice(0)) {
|
||||||
|
debug("bootstrap: unregister factory: " + factory.classID);
|
||||||
manager.unregisterFactory(factory.classID, factory);
|
manager.unregisterFactory(factory.classID, factory);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
Factory: function Factory(class_) ({
|
Factory: function Factory(class_) ({
|
||||||
@@ -202,6 +204,7 @@ let JSMLoader = {
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
registerFactory: function registerFactory(factory) {
|
registerFactory: function registerFactory(factory) {
|
||||||
|
debug("bootstrap: register factory: " + factory.classID + " " + factory.contractID);
|
||||||
manager.registerFactory(factory.classID,
|
manager.registerFactory(factory.classID,
|
||||||
String(factory.classID),
|
String(factory.classID),
|
||||||
factory.contractID,
|
factory.contractID,
|
||||||
|
|||||||
@@ -188,6 +188,11 @@ var Events = Module("events", {
|
|||||||
|
|
||||||
this.listen(window, this, "events", true);
|
this.listen(window, this, "events", true);
|
||||||
this.listen(window, this.popups, "events", true);
|
this.listen(window, this.popups, "events", true);
|
||||||
|
|
||||||
|
this.grabFocus = 0;
|
||||||
|
this.grabFocusTimer = Timer(100, 10000, () => {
|
||||||
|
this.grabFocus = 0;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
cleanup: function cleanup() {
|
cleanup: function cleanup() {
|
||||||
@@ -616,11 +621,15 @@ var Events = Module("events", {
|
|||||||
Ci.nsIDOMHTMLSelectElement,
|
Ci.nsIDOMHTMLSelectElement,
|
||||||
Ci.nsIDOMHTMLTextAreaElement,
|
Ci.nsIDOMHTMLTextAreaElement,
|
||||||
Ci.nsIDOMWindow])) {
|
Ci.nsIDOMWindow])) {
|
||||||
|
if (this.grabFocus++ > 5)
|
||||||
if (elem.frameElement)
|
; // Something is fighting us. Give up.
|
||||||
dactyl.focusContent(true);
|
else {
|
||||||
else if (!(elem instanceof Window) || Editor.getEditor(elem))
|
this.grabFocusTimer.tell();
|
||||||
dactyl.focus(window);
|
if (elem.frameElement)
|
||||||
|
dactyl.focusContent(true);
|
||||||
|
else if (!(elem instanceof Window) || Editor.getEditor(elem))
|
||||||
|
dactyl.focus(window);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem instanceof Element)
|
if (elem instanceof Element)
|
||||||
|
|||||||
@@ -53,10 +53,14 @@ var ConfigBase = Class("ConfigBase", {
|
|||||||
|
|
||||||
this.loadConfig();
|
this.loadConfig();
|
||||||
|
|
||||||
JSMLoader.registerFactory(JSMLoader.Factory(AboutHandler));
|
util.trapErrors(() => {
|
||||||
JSMLoader.registerFactory(JSMLoader.Factory(
|
JSMLoader.registerFactory(JSMLoader.Factory(AboutHandler));
|
||||||
Protocol("dactyl", "{9c8f2530-51c8-4d41-b356-319e0b155c44}",
|
});
|
||||||
"resource://dactyl-content/")));
|
util.withProperErrors(() => {
|
||||||
|
JSMLoader.registerFactory(JSMLoader.Factory(
|
||||||
|
Protocol("dactyl", "{9c8f2530-51c8-4d41-b356-319e0b155c44}",
|
||||||
|
"resource://dactyl-content/")));
|
||||||
|
});
|
||||||
|
|
||||||
this.protocolLoaded = true;
|
this.protocolLoaded = true;
|
||||||
this.timeout(function () {
|
this.timeout(function () {
|
||||||
|
|||||||
@@ -1174,8 +1174,6 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
util.trapErrors(module.cleanup, module, reason);
|
util.trapErrors(module.cleanup, module, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSMLoader.cleanup();
|
|
||||||
|
|
||||||
if (!this.rehashing)
|
if (!this.rehashing)
|
||||||
services.observer.addObserver(this, "dactyl-rehash", true);
|
services.observer.addObserver(this, "dactyl-rehash", true);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user