mirror of
https://github.com/moparisthebest/FireTray
synced 2024-11-11 03:25:07 -05:00
don't cache and update windows[wid].visible, windowsCount, visibleWindowsCount
Because the number of windows will generally be small, this is not worth the effort.
This commit is contained in:
parent
7a0ff56cd1
commit
705b0ffb59
@ -2,7 +2,7 @@
|
|||||||
<?xml-stylesheet href="chrome://firetray/skin/overlay.css" type="text/css"?>
|
<?xml-stylesheet href="chrome://firetray/skin/overlay.css" type="text/css"?>
|
||||||
<!DOCTYPE overlay SYSTEM "chrome://firetray/locale/overlay.dtd">
|
<!DOCTYPE overlay SYSTEM "chrome://firetray/locale/overlay.dtd">
|
||||||
<overlay id="firetray-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
<overlay id="firetray-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||||
<script type="application/javascript;version=1.7" src="overlay.js"/>
|
<script type="application/javascript;version=1.8" src="overlay.js"/>
|
||||||
|
|
||||||
<stringbundleset id="stringbundleset">
|
<stringbundleset id="stringbundleset">
|
||||||
<stringbundle id="firetray-strings" src="chrome://firetray/locale/overlay.properties"/>
|
<stringbundle id="firetray-strings" src="chrome://firetray/locale/overlay.properties"/>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var EXPORTED_SYMBOLS = [ "firetray" ];
|
var EXPORTED_SYMBOLS = [ "firetray" ];
|
||||||
|
|
||||||
@ -36,13 +37,15 @@ firetray.Handler = {
|
|||||||
inMailApp: false,
|
inMailApp: false,
|
||||||
appHasChat: false,
|
appHasChat: false,
|
||||||
appStarted: false,
|
appStarted: false,
|
||||||
/* TODO: we should rewrite firetray.Handler[wid].visible,
|
|
||||||
firetray.Handler.windowsCount, firetray.Handler.visibleWindowsCount as
|
|
||||||
getters. They mainly serve as a cache for computing the visibilityRate but
|
|
||||||
tend to be a bit heavy to handle. */
|
|
||||||
windows: {},
|
windows: {},
|
||||||
windowsCount: 0,
|
get windowsCount() {return Object.keys(this.windows).length;},
|
||||||
visibleWindowsCount: 0,
|
get visibleWindowsCount() {
|
||||||
|
let count = 0;
|
||||||
|
for (let wid in firetray.Handler.windows) {
|
||||||
|
if (firetray.Handler.windows[wid].visible) count += 1;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
},
|
||||||
observedTopics: {},
|
observedTopics: {},
|
||||||
ctypesLibs: {}, // {"lib1": lib1, "lib2": lib2}
|
ctypesLibs: {}, // {"lib1": lib1, "lib2": lib2}
|
||||||
|
|
||||||
@ -69,17 +72,17 @@ firetray.Handler = {
|
|||||||
switch (this.runtimeOS) {
|
switch (this.runtimeOS) {
|
||||||
case "Linux":
|
case "Linux":
|
||||||
Cu.import("resource://firetray/linux/FiretrayStatusIcon.jsm");
|
Cu.import("resource://firetray/linux/FiretrayStatusIcon.jsm");
|
||||||
log.debug('FiretrayStatusIcon imported');
|
log.debug('FiretrayStatusIcon Linux imported');
|
||||||
Cu.import("resource://firetray/linux/FiretrayWindow.jsm");
|
Cu.import("resource://firetray/linux/FiretrayWindow.jsm");
|
||||||
log.debug('FiretrayWindow imported');
|
log.debug('FiretrayWindow Linux imported');
|
||||||
break;
|
break;
|
||||||
case "WINNT":
|
case "WINNT":
|
||||||
Cu.import("resource://firetray/winnt/FiretrayWin32.jsm");
|
Cu.import("resource://firetray/winnt/FiretrayWin32.jsm");
|
||||||
log.debug('FiretrayWin32 imported');
|
log.debug('FiretrayWin32 imported');
|
||||||
Cu.import("resource://firetray/winnt/FiretrayStatusIcon.jsm");
|
Cu.import("resource://firetray/winnt/FiretrayStatusIcon.jsm");
|
||||||
log.debug('FiretrayStatusIcon imported');
|
log.debug('FiretrayStatusIcon WINNT imported');
|
||||||
Cu.import("resource://firetray/winnt/FiretrayWindow.jsm");
|
Cu.import("resource://firetray/winnt/FiretrayWindow.jsm");
|
||||||
log.debug('FiretrayWindow imported');
|
log.debug('FiretrayWindow WINNT imported');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log.error("FIRETRAY: only Linux and WINNT platforms supported at this"
|
log.error("FIRETRAY: only Linux and WINNT platforms supported at this"
|
||||||
@ -196,7 +199,7 @@ firetray.Handler = {
|
|||||||
|
|
||||||
tryCloseLibs: function() {
|
tryCloseLibs: function() {
|
||||||
try {
|
try {
|
||||||
for (libName in this.ctypesLibs) {
|
for (let libName in this.ctypesLibs) {
|
||||||
let lib = this.ctypesLibs[libName];
|
let lib = this.ctypesLibs[libName];
|
||||||
if (lib.available())
|
if (lib.available())
|
||||||
lib.close();
|
lib.close();
|
||||||
@ -333,7 +336,6 @@ firetray.Handler = {
|
|||||||
unregisterWindow: function(win) {},
|
unregisterWindow: function(win) {},
|
||||||
hideWindow: function(winId) {},
|
hideWindow: function(winId) {},
|
||||||
showWindow: function(winId) {},
|
showWindow: function(winId) {},
|
||||||
showHideAllWindows: function() {},
|
|
||||||
activateLastWindowCb: function(gtkStatusIcon, gdkEvent, userData) {},
|
activateLastWindowCb: function(gtkStatusIcon, gdkEvent, userData) {},
|
||||||
getActiveWindow: function() {},
|
getActiveWindow: function() {},
|
||||||
|
|
||||||
@ -352,6 +354,21 @@ firetray.Handler = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showHideAllWindows: function() {
|
||||||
|
log.debug("showHideAllWindows");
|
||||||
|
log.debug(" visibleWindowsCount="+firetray.Handler.visibleWindowsCount +
|
||||||
|
" / windowsCount="+firetray.Handler.windowsCount);
|
||||||
|
let visibilityRate = firetray.Handler.visibleWindowsCount /
|
||||||
|
firetray.Handler.windowsCount;
|
||||||
|
log.debug(" visibilityRate="+visibilityRate);
|
||||||
|
if ((0.5 < visibilityRate) && (visibilityRate < 1)
|
||||||
|
|| visibilityRate === 0) { // TODO: should be configurable
|
||||||
|
firetray.Handler.showAllWindows();
|
||||||
|
} else {
|
||||||
|
firetray.Handler.hideAllWindows();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
showHideIcon: function() {
|
showHideIcon: function() {
|
||||||
if (firetray.Utils.prefService.getBoolPref('show_icon_on_hide'))
|
if (firetray.Utils.prefService.getBoolPref('show_icon_on_hide'))
|
||||||
firetray.Handler.setIconVisibility(
|
firetray.Handler.setIconVisibility(
|
||||||
|
@ -17,18 +17,6 @@ if ("undefined" == typeof(firetray.Handler))
|
|||||||
function FiretrayWindow () {}
|
function FiretrayWindow () {}
|
||||||
FiretrayWindow.prototype = {
|
FiretrayWindow.prototype = {
|
||||||
|
|
||||||
updateVisibility: function(winId, visibility) {
|
|
||||||
let win = firetray.Handler.windows[winId];
|
|
||||||
if (win.visible === visibility)
|
|
||||||
log.warn("window (winId="+winId+") was already visible="+win.visible);
|
|
||||||
|
|
||||||
firetray.Handler.visibleWindowsCount = visibility ?
|
|
||||||
firetray.Handler.visibleWindowsCount + 1 :
|
|
||||||
firetray.Handler.visibleWindowsCount - 1 ;
|
|
||||||
|
|
||||||
win.visible = visibility; // nsIBaseWin.visibility always true :-(
|
|
||||||
},
|
|
||||||
|
|
||||||
getRegisteredWinIdFromChromeWindow: function(win) {
|
getRegisteredWinIdFromChromeWindow: function(win) {
|
||||||
for (let wid in firetray.Handler.windows)
|
for (let wid in firetray.Handler.windows)
|
||||||
if (firetray.Handler.windows[wid].chromeWin === win) return wid;
|
if (firetray.Handler.windows[wid].chromeWin === win) return wid;
|
||||||
|
@ -145,6 +145,7 @@ function gtk_defines(lib) {
|
|||||||
|
|
||||||
lib.lazy_bind("gtk_widget_is_focus", gobject.gboolean, this.GtkWidget.ptr);
|
lib.lazy_bind("gtk_widget_is_focus", gobject.gboolean, this.GtkWidget.ptr);
|
||||||
lib.lazy_bind("gtk_widget_has_focus", gobject.gboolean, this.GtkWidget.ptr);
|
lib.lazy_bind("gtk_widget_has_focus", gobject.gboolean, this.GtkWidget.ptr);
|
||||||
|
lib.lazy_bind("gtk_widget_get_visible", gobject.gboolean, this.GtkWidget.ptr);
|
||||||
lib.lazy_bind("gtk_widget_hide_on_delete", gobject.gboolean, this.GtkWidget.ptr);
|
lib.lazy_bind("gtk_widget_hide_on_delete", gobject.gboolean, this.GtkWidget.ptr);
|
||||||
lib.lazy_bind("gtk_widget_hide", ctypes.void_t, this.GtkWidget.ptr);
|
lib.lazy_bind("gtk_widget_hide", ctypes.void_t, this.GtkWidget.ptr);
|
||||||
lib.lazy_bind("gtk_widget_show", ctypes.void_t, this.GtkWidget.ptr);
|
lib.lazy_bind("gtk_widget_show", ctypes.void_t, this.GtkWidget.ptr);
|
||||||
|
@ -135,7 +135,7 @@ firetray.StatusIcon = {
|
|||||||
|
|
||||||
log.debug("showHideAllWindows: "+firetray.Handler.hasOwnProperty("showHideAllWindows"));
|
log.debug("showHideAllWindows: "+firetray.Handler.hasOwnProperty("showHideAllWindows"));
|
||||||
this.callbacks.iconActivate = gtk.GCallbackStatusIconActivate_t(
|
this.callbacks.iconActivate = gtk.GCallbackStatusIconActivate_t(
|
||||||
firetray.Handler.showHideAllWindows);
|
firetray.StatusIcon.onClick);
|
||||||
let handlerId = gobject.g_signal_connect(firetray.StatusIcon.trayIcon,
|
let handlerId = gobject.g_signal_connect(firetray.StatusIcon.trayIcon,
|
||||||
"activate", firetray.StatusIcon.callbacks.iconActivate, null);
|
"activate", firetray.StatusIcon.callbacks.iconActivate, null);
|
||||||
log.debug("g_connect activate="+handlerId);
|
log.debug("g_connect activate="+handlerId);
|
||||||
@ -176,6 +176,12 @@ firetray.StatusIcon = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onClick: function(gtkStatusIcon, userData) {
|
||||||
|
firetray.Handler.showHideAllWindows();
|
||||||
|
let stopPropagation = true;
|
||||||
|
return stopPropagation;
|
||||||
|
},
|
||||||
|
|
||||||
setIconImageFromFile: function(filename) {
|
setIconImageFromFile: function(filename) {
|
||||||
if (!firetray.StatusIcon.trayIcon)
|
if (!firetray.StatusIcon.trayIcon)
|
||||||
log.error("Icon missing");
|
log.error("Icon missing");
|
||||||
|
@ -219,8 +219,6 @@ firetray.Window.unregisterWindowByXID = function(xid) {
|
|||||||
throw new DeleteError();
|
throw new DeleteError();
|
||||||
firetray.Handler.gtkWindows.remove(xid);
|
firetray.Handler.gtkWindows.remove(xid);
|
||||||
firetray.Handler.gdkWindows.remove(xid);
|
firetray.Handler.gdkWindows.remove(xid);
|
||||||
firetray.Handler.windowsCount -= 1;
|
|
||||||
firetray.Handler.visibleWindowsCount -= 1;
|
|
||||||
|
|
||||||
firetray.PopupMenu.removeWindowItem(xid);
|
firetray.PopupMenu.removeWindowItem(xid);
|
||||||
|
|
||||||
@ -357,6 +355,12 @@ firetray.Window.restoreDesktop = function(xid) {
|
|||||||
delete firetray.Handler.windows[xid].savedDesktop;
|
delete firetray.Handler.windows[xid].savedDesktop;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
firetray.Window.getVisibility = function(xid) {
|
||||||
|
let gtkWidget = ctypes.cast(firetray.Handler.gtkWindows.get(xid), gtk.GtkWidget.ptr);
|
||||||
|
// nsIBaseWin.visibility always true
|
||||||
|
return gtk.gtk_widget_get_visible(gtkWidget);
|
||||||
|
};
|
||||||
|
|
||||||
firetray.Window.setVisibility = function(xid, visibility) {
|
firetray.Window.setVisibility = function(xid, visibility) {
|
||||||
log.debug("setVisibility="+visibility);
|
log.debug("setVisibility="+visibility);
|
||||||
let gtkWidget = ctypes.cast(firetray.Handler.gtkWindows.get(xid), gtk.GtkWidget.ptr);
|
let gtkWidget = ctypes.cast(firetray.Handler.gtkWindows.get(xid), gtk.GtkWidget.ptr);
|
||||||
@ -364,10 +368,7 @@ firetray.Window.setVisibility = function(xid, visibility) {
|
|||||||
gtk.gtk_widget_show_all(gtkWidget);
|
gtk.gtk_widget_show_all(gtkWidget);
|
||||||
else
|
else
|
||||||
gtk.gtk_widget_hide(gtkWidget);
|
gtk.gtk_widget_hide(gtkWidget);
|
||||||
|
|
||||||
this.updateVisibility(xid, visibility);
|
|
||||||
};
|
};
|
||||||
// firetray.Window.updateVisibility inherited
|
|
||||||
|
|
||||||
firetray.Window.xSendClientMessgeEvent = function(xid, atom, data, dataSize) {
|
firetray.Window.xSendClientMessgeEvent = function(xid, atom, data, dataSize) {
|
||||||
let xev = new x11.XClientMessageEvent;
|
let xev = new x11.XClientMessageEvent;
|
||||||
@ -544,7 +545,6 @@ firetray.Window.filterWindow = function(xev, gdkEv, data) {
|
|||||||
// when app hidden at startup, then called from command line without
|
// when app hidden at startup, then called from command line without
|
||||||
// any argument (not through FireTray that is)
|
// any argument (not through FireTray that is)
|
||||||
log.warn("window not visible, correcting visibility");
|
log.warn("window not visible, correcting visibility");
|
||||||
firetray.Window.updateVisibility(xid, true);
|
|
||||||
log.debug("visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
|
log.debug("visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -656,6 +656,9 @@ firetray.Handler.registerWindow = function(win) {
|
|||||||
this.windows[xid] = {};
|
this.windows[xid] = {};
|
||||||
this.windows[xid].chromeWin = win;
|
this.windows[xid].chromeWin = win;
|
||||||
this.windows[xid].baseWin = baseWin;
|
this.windows[xid].baseWin = baseWin;
|
||||||
|
Object.defineProperties(this.windows[xid], {
|
||||||
|
"visible": { get: function(){return firetray.Window.getVisibility(xid);} }
|
||||||
|
});
|
||||||
firetray.Window.checkSubscribedEventMasks(xid);
|
firetray.Window.checkSubscribedEventMasks(xid);
|
||||||
try {
|
try {
|
||||||
this.gtkWindows.insert(xid, gtkWin);
|
this.gtkWindows.insert(xid, gtkWin);
|
||||||
@ -667,10 +670,6 @@ firetray.Handler.registerWindow = function(win) {
|
|||||||
+" windows open. This breaks FireTray and most probably "
|
+" windows open. This breaks FireTray and most probably "
|
||||||
+firetray.Handler.appName+".");
|
+firetray.Handler.appName+".");
|
||||||
}
|
}
|
||||||
this.windowsCount += 1;
|
|
||||||
// NOTE: no need to check for window state to set visibility because all
|
|
||||||
// windows *are* shown at startup
|
|
||||||
firetray.Window.updateVisibility(xid, true);
|
|
||||||
log.debug("window "+xid+" registered");
|
log.debug("window "+xid+" registered");
|
||||||
// NOTE: shouldn't be necessary to gtk_widget_add_events(gtkWin, gdk.GDK_ALL_EVENTS_MASK);
|
// NOTE: shouldn't be necessary to gtk_widget_add_events(gtkWin, gdk.GDK_ALL_EVENTS_MASK);
|
||||||
|
|
||||||
@ -710,26 +709,6 @@ firetray.Handler.unregisterWindow = function(win) {
|
|||||||
firetray.Handler.showWindow = firetray.Window.show;
|
firetray.Handler.showWindow = firetray.Window.show;
|
||||||
firetray.Handler.hideWindow = firetray.Window.hide;
|
firetray.Handler.hideWindow = firetray.Window.hide;
|
||||||
|
|
||||||
firetray.Handler.showHideAllWindows = function(gtkStatusIcon, userData) {
|
|
||||||
log.debug("showHideAllWindows: "+userData);
|
|
||||||
// NOTE: showHideAllWindows being a callback, we need to use
|
|
||||||
// 'firetray.Handler' explicitely instead of 'this'
|
|
||||||
|
|
||||||
log.debug("visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
|
|
||||||
log.debug("windowsCount="+firetray.Handler.windowsCount);
|
|
||||||
let visibilityRate = firetray.Handler.visibleWindowsCount/firetray.Handler.windowsCount;
|
|
||||||
log.debug("visibilityRate="+visibilityRate);
|
|
||||||
if ((0.5 < visibilityRate) && (visibilityRate < 1)
|
|
||||||
|| visibilityRate === 0) { // TODO: should be configurable
|
|
||||||
firetray.Handler.showAllWindows();
|
|
||||||
} else {
|
|
||||||
firetray.Handler.hideAllWindows();
|
|
||||||
}
|
|
||||||
|
|
||||||
let stopPropagation = true;
|
|
||||||
return stopPropagation;
|
|
||||||
};
|
|
||||||
|
|
||||||
firetray.Handler.showAllWindowsAndActivate = firetray.Window.showAllWindowsAndActivate;
|
firetray.Handler.showAllWindowsAndActivate = firetray.Window.showAllWindowsAndActivate;
|
||||||
firetray.Handler.activateLastWindowCb = function(gtkStatusIcon, gdkEvent, userData) {
|
firetray.Handler.activateLastWindowCb = function(gtkStatusIcon, gdkEvent, userData) {
|
||||||
log.debug("activateLastWindowCb");
|
log.debug("activateLastWindowCb");
|
||||||
|
@ -39,22 +39,19 @@ firetray.Window.shutdown = function() {
|
|||||||
this.initialized = false;
|
this.initialized = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
firetray.Window.getVisibility = function(hwnd) {
|
firetray.Window.getVisibility = function(wid) {
|
||||||
|
let hwnd = firetray.Win32.hexStrToHwnd(wid);
|
||||||
let style = user32.GetWindowLongW(hwnd, user32.GWL_STYLE);
|
let style = user32.GetWindowLongW(hwnd, user32.GWL_STYLE);
|
||||||
let visible = ((style & user32.WS_VISIBLE) != 0); // user32.IsWindowVisible(hwnd);
|
return ((style & user32.WS_VISIBLE) != 0); // user32.IsWindowVisible(hwnd);
|
||||||
log.debug("visible="+visible);
|
|
||||||
return visible;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// firetray.Window.{show,hide} useless
|
// firetray.Window.{show,hide} useless as we don't need to restore position and size
|
||||||
firetray.Window.setVisibility = function(wid, visible) {
|
firetray.Window.setVisibility = function(wid, visible) {
|
||||||
log.debug("setVisibility="+visible);
|
log.debug("setVisibility="+visible);
|
||||||
let hwnd = firetray.Win32.hexStrToHwnd(wid);
|
let hwnd = firetray.Win32.hexStrToHwnd(wid);
|
||||||
let ret = user32.ShowWindow(hwnd, visible ? user32.SW_SHOW : user32.SW_HIDE);
|
let ret = user32.ShowWindow(hwnd, visible ? user32.SW_SHOW : user32.SW_HIDE);
|
||||||
log.debug(" ShowWindow="+ret+" winLastError="+ctypes.winLastError);
|
log.debug(" ShowWindow="+ret+" winLastError="+ctypes.winLastError);
|
||||||
this.updateVisibility(wid, visible);
|
|
||||||
};
|
};
|
||||||
// firetray.Window.updateVisibility inherited
|
|
||||||
|
|
||||||
firetray.Window.wndProc = function(hWnd, uMsg, wParam, lParam) { // filterWindow
|
firetray.Window.wndProc = function(hWnd, uMsg, wParam, lParam) { // filterWindow
|
||||||
// log.debug("wndProc CALLED: hWnd="+hWnd+", uMsg="+uMsg+", wParam="+wParam+", lParam="+lParam);
|
// log.debug("wndProc CALLED: hWnd="+hWnd+", uMsg="+uMsg+", wParam="+wParam+", lParam="+lParam);
|
||||||
@ -120,14 +117,15 @@ firetray.Handler.registerWindow = function(win) {
|
|||||||
this.windows[wid] = {};
|
this.windows[wid] = {};
|
||||||
this.windows[wid].chromeWin = win;
|
this.windows[wid].chromeWin = win;
|
||||||
this.windows[wid].baseWin = baseWin;
|
this.windows[wid].baseWin = baseWin;
|
||||||
|
Object.defineProperties(this.windows[wid], {
|
||||||
|
"visible": { get: function(){return firetray.Window.getVisibility(wid);} }
|
||||||
|
});
|
||||||
|
|
||||||
|
log.debug("window "+wid+" registered");
|
||||||
|
|
||||||
// SetupWnd(hwnd);
|
// SetupWnd(hwnd);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.windowsCount += 1;
|
|
||||||
firetray.Window.updateVisibility(wid, true); // windows *are* visible at startup
|
|
||||||
log.debug("window "+wid+" registered");
|
|
||||||
|
|
||||||
let wndProc = user32.WNDPROC(firetray.Window.wndProc);
|
let wndProc = user32.WNDPROC(firetray.Window.wndProc);
|
||||||
log.debug("proc="+wndProc);
|
log.debug("proc="+wndProc);
|
||||||
this.wndProcs.insert(wid, wndProc);
|
this.wndProcs.insert(wid, wndProc);
|
||||||
@ -167,8 +165,6 @@ firetray.Handler.unregisterWindow = function(win) {
|
|||||||
|
|
||||||
if (!delete firetray.Handler.windows[wid])
|
if (!delete firetray.Handler.windows[wid])
|
||||||
throw new DeleteError();
|
throw new DeleteError();
|
||||||
firetray.Handler.windowsCount -= 1;
|
|
||||||
firetray.Handler.visibleWindowsCount -= 1;
|
|
||||||
|
|
||||||
log.debug("window "+wid+" unregistered");
|
log.debug("window "+wid+" unregistered");
|
||||||
return true;
|
return true;
|
||||||
@ -180,18 +176,3 @@ firetray.Handler.showWindow = function(wid) {
|
|||||||
firetray.Handler.hideWindow = function(wid) {
|
firetray.Handler.hideWindow = function(wid) {
|
||||||
return firetray.Window.setVisibility(wid, false);
|
return firetray.Window.setVisibility(wid, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
firetray.Handler.showHideAllWindows = function() {
|
|
||||||
log.debug("showHideAllWindows");
|
|
||||||
|
|
||||||
log.debug(" visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
|
|
||||||
log.debug(" windowsCount="+firetray.Handler.windowsCount);
|
|
||||||
let visibilityRate = firetray.Handler.visibleWindowsCount/firetray.Handler.windowsCount;
|
|
||||||
log.debug(" visibilityRate="+visibilityRate);
|
|
||||||
if ((0.5 < visibilityRate) && (visibilityRate < 1)
|
|
||||||
|| visibilityRate === 0) { // TODO: should be configurable
|
|
||||||
firetray.Handler.showAllWindows();
|
|
||||||
} else {
|
|
||||||
firetray.Handler.hideAllWindows();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user