mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 13:47:57 +01:00
Add dactyl instance tracking.
This commit is contained in:
@@ -51,9 +51,7 @@ CommandLineHandler.prototype = {
|
|||||||
if (remote) {
|
if (remote) {
|
||||||
commandLine.preventDefault = true;
|
commandLine.preventDefault = true;
|
||||||
require(global, "services");
|
require(global, "services");
|
||||||
let win = services.windowMediator.getMostRecentWindow("navigator:browser");
|
util.dactyl.execute(remote);
|
||||||
if (win && win.dactyl)
|
|
||||||
win.dactyl.execute(remote);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
|
|||||||
@@ -495,6 +495,12 @@ var Events = Module("events", {
|
|||||||
|
|
||||||
this._activeMenubar = false;
|
this._activeMenubar = false;
|
||||||
this.listen(window, this, "events");
|
this.listen(window, this, "events");
|
||||||
|
|
||||||
|
util.windows = [window].concat(util.windows);
|
||||||
|
},
|
||||||
|
|
||||||
|
destroy: function destroy() {
|
||||||
|
util.windows = util.windows.filter(function (w) w != window);
|
||||||
},
|
},
|
||||||
|
|
||||||
signals: {
|
signals: {
|
||||||
@@ -705,7 +711,7 @@ var Events = Module("events", {
|
|||||||
|
|
||||||
let event = DOM.Event(doc, type, evt);
|
let event = DOM.Event(doc, type, evt);
|
||||||
if (!evt_obj.dactylString && !mode)
|
if (!evt_obj.dactylString && !mode)
|
||||||
events.dispatch(target, event, evt);
|
DOM.Event.dispatch(target, event, evt);
|
||||||
else if (type === "keypress")
|
else if (type === "keypress")
|
||||||
events.events.keypress.call(events, event);
|
events.events.keypress.call(events, event);
|
||||||
}
|
}
|
||||||
@@ -1153,6 +1159,9 @@ var Events = Module("events", {
|
|||||||
focus: function onFocus(event) {
|
focus: function onFocus(event) {
|
||||||
let elem = event.originalTarget;
|
let elem = event.originalTarget;
|
||||||
|
|
||||||
|
if (elem == window)
|
||||||
|
util.windows = [window].concat(util.windows.filter(function (w) w != window));
|
||||||
|
|
||||||
elem.dactylHadFocus = true;
|
elem.dactylHadFocus = true;
|
||||||
if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
|
if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
|
||||||
if (Events.isHidden(elem, true))
|
if (Events.isHidden(elem, true))
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
|
|
||||||
this.addObserver(this);
|
this.addObserver(this);
|
||||||
this.overlays = {};
|
this.overlays = {};
|
||||||
|
this.windows = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
cleanup: function cleanup() {
|
cleanup: function cleanup() {
|
||||||
@@ -84,14 +85,16 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// FIXME: Only works for Pentadactyl
|
get activeWindow() this.windows[0],
|
||||||
get activeWindow() services.windowMediator.getMostRecentWindow("navigator:browser"),
|
|
||||||
dactyl: update(function dactyl(obj) {
|
dactyl: update(function dactyl(obj) {
|
||||||
if (obj)
|
if (obj)
|
||||||
var global = Class.objectGlobal(obj);
|
var global = Class.objectGlobal(obj);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
__noSuchMethod__: function (meth, args) {
|
__noSuchMethod__: function (meth, args) {
|
||||||
let win = util.activeWindow;
|
let win = util.activeWindow;
|
||||||
|
|
||||||
var dactyl = global && global.dactyl || win && win.dactyl;
|
var dactyl = global && global.dactyl || win && win.dactyl;
|
||||||
if (!dactyl)
|
if (!dactyl)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user