mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-07 17:35:48 +01:00
Make overlay.windows a set.
This commit is contained in:
@@ -1209,7 +1209,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
* @property {[Window]} Returns an array of all the host application's
|
* @property {[Window]} Returns an array of all the host application's
|
||||||
* open windows.
|
* open windows.
|
||||||
*/
|
*/
|
||||||
get windows() [win for (win in iter(services.windowMediator.getEnumerator("navigator:browser"))) if (win.dactyl)],
|
get windows() [w for (w of overlay.windows)]
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
toolbarHidden: function hidden(elem) (elem.getAttribute("autohide") || elem.getAttribute("collapsed")) == "true"
|
toolbarHidden: function hidden(elem) (elem.getAttribute("autohide") || elem.getAttribute("collapsed")) == "true"
|
||||||
@@ -1591,7 +1591,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
function (args) {
|
function (args) {
|
||||||
if (dactyl.has("tabs") && tabs.remove(tabs.getTab(), 1, false))
|
if (dactyl.has("tabs") && tabs.remove(tabs.getTab(), 1, false))
|
||||||
return;
|
return;
|
||||||
else if (dactyl.windows.length > 1)
|
else if (dactyl.windows.size > 1)
|
||||||
window.close();
|
window.close();
|
||||||
else
|
else
|
||||||
dactyl.quit(false, args.bang);
|
dactyl.quit(false, args.bang);
|
||||||
|
|||||||
@@ -378,6 +378,9 @@ function values(obj) iter(function values() {
|
|||||||
else if (isinstance(obj, ["Generator", "Iterator", Iter]))
|
else if (isinstance(obj, ["Generator", "Iterator", Iter]))
|
||||||
for (let k in obj)
|
for (let k in obj)
|
||||||
yield k;
|
yield k;
|
||||||
|
else if (iter.iteratorProp in obj)
|
||||||
|
for (let v of obj)
|
||||||
|
yield v;
|
||||||
else
|
else
|
||||||
for (var k in obj)
|
for (var k in obj)
|
||||||
if (hasOwnProperty(obj, k))
|
if (hasOwnProperty(obj, k))
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ overlay.overlayWindow(Object.keys(config.overlays),
|
|||||||
},
|
},
|
||||||
|
|
||||||
cleanup: function cleanup(window) {
|
cleanup: function cleanup(window) {
|
||||||
overlay.windows = overlay.windows.filter(w => w != window);
|
overlay.windows.remove(window);
|
||||||
|
|
||||||
Cu.nukeSandbox(this.jsmodules);
|
Cu.nukeSandbox(this.jsmodules);
|
||||||
},
|
},
|
||||||
@@ -252,7 +252,7 @@ overlay.overlayWindow(Object.keys(config.overlays),
|
|||||||
|
|
||||||
defineModule.loadLog.push("Loaded in " + (Date.now() - this.startTime) + "ms");
|
defineModule.loadLog.push("Loaded in " + (Date.now() - this.startTime) + "ms");
|
||||||
|
|
||||||
overlay.windows = array.uniq(overlay.windows.concat(window), true);
|
overlay.windows.add(window);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadModule: function loadModule(module, prereq, frame) {
|
loadModule: function loadModule(module, prereq, frame) {
|
||||||
|
|||||||
@@ -404,19 +404,22 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
|||||||
|
|
||||||
get activeModules() this.activeWindow && this.activeWindow.dactyl.modules,
|
get activeModules() this.activeWindow && this.activeWindow.dactyl.modules,
|
||||||
|
|
||||||
get modules() this.windows.map(w => w.dactyl.modules),
|
get modules() [w.dactyl.modules for (w of this.windows)],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The most recently active dactyl window.
|
* The most recently active dactyl window.
|
||||||
*/
|
*/
|
||||||
get activeWindow() this.windows[0],
|
get activeWindow() {
|
||||||
|
let win = this._activeWindow && this._activeWindow.get();
|
||||||
|
return this.windows.has(win) && win;
|
||||||
|
},
|
||||||
|
|
||||||
set activeWindow(win) this.windows = [win].concat(this.windows.filter(w => w != win)),
|
set activeWindow(win) this._activeWindow = util.weakReference(win),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of extant dactyl windows.
|
* A list of extant dactyl windows.
|
||||||
*/
|
*/
|
||||||
windows: Class.Memoize(() => [])
|
windows: Class.Memoize(() => RealSet())
|
||||||
});
|
});
|
||||||
|
|
||||||
endModule();
|
endModule();
|
||||||
|
|||||||
Reference in New Issue
Block a user