mirror of
https://github.com/moparisthebest/FireTray
synced 2024-12-22 05:48:49 -05:00
correct visibility state when hidden application called from command line
This commit is contained in:
parent
22de1d3fcc
commit
39f3c20fa8
@ -202,8 +202,8 @@ firetray.Window = {
|
||||
},
|
||||
|
||||
unregisterWindowByXID: function(xid) {
|
||||
firetray.Handler.windowsCount -= 1;
|
||||
if (firetray.Handler.windows[xid].visible) firetray.Handler.visibleWindowsCount -= 1;
|
||||
this.updateVisibility(xid, false);
|
||||
|
||||
if (firetray.Handler.windows.hasOwnProperty(xid)) {
|
||||
if (!delete firetray.Handler.windows[xid])
|
||||
throw new DeleteError();
|
||||
@ -256,8 +256,7 @@ firetray.Window = {
|
||||
log.debug('startupHide: '+xid);
|
||||
|
||||
firetray.Handler.windows[xid].baseWin.visibility = false;
|
||||
firetray.Handler.windows[xid].visible = false;
|
||||
firetray.Handler.visibleWindowsCount -= 1;
|
||||
this.updateVisibility(xid, false);
|
||||
|
||||
firetray.PopupMenu.showWindowItem(xid);
|
||||
firetray.Handler.showHideIcon();
|
||||
@ -350,10 +349,19 @@ firetray.Window = {
|
||||
else
|
||||
gtk.gtk_widget_hide(gtkWidget);
|
||||
|
||||
firetray.Handler.windows[xid].visible = visibility;
|
||||
this.updateVisibility(xid, visibility);
|
||||
},
|
||||
|
||||
updateVisibility: function(xid, visibility) {
|
||||
let win = firetray.Handler.windows[xid];
|
||||
if (win.visible === visibility)
|
||||
log.warn("window (xid="+xid+") was already visible="+win.visible);
|
||||
|
||||
firetray.Handler.visibleWindowsCount = visibility ?
|
||||
firetray.Handler.visibleWindowsCount + 1 :
|
||||
firetray.Handler.visibleWindowsCount - 1 ;
|
||||
|
||||
win.visible = visibility; // nsIBaseWin.visibility always true :-(
|
||||
},
|
||||
|
||||
xSendClientMessgeEvent: function(xid, atom, data, dataSize) {
|
||||
@ -509,13 +517,23 @@ firetray.Window = {
|
||||
return gdk.GDK_FILTER_CONTINUE;
|
||||
|
||||
let xany = ctypes.cast(xev, x11.XAnyEvent.ptr);
|
||||
let xwin = xany.contents.window;
|
||||
let xid = xany.contents.window;
|
||||
|
||||
switch (xany.contents.type) {
|
||||
|
||||
case x11.UnmapNotify:
|
||||
let gdkWinState = gdk.gdk_window_get_state(firetray.Handler.gdkWindows.get(xwin));
|
||||
log.debug("gdkWinState="+gdkWinState+" for xid="+xwin);
|
||||
case x11.MapNotify:
|
||||
log.debug("MapNotify");
|
||||
let win = firetray.Handler.windows[xid];
|
||||
if (!win.visible) { // happens when hidden app called from command line
|
||||
log.warn("window not visible, correcting visibility");
|
||||
firetray.Window.updateVisibility(xid, true);
|
||||
log.debug("visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
|
||||
}
|
||||
break;
|
||||
|
||||
case x11.UnmapNotify: // for catching 'iconify'
|
||||
let gdkWinState = gdk.gdk_window_get_state(firetray.Handler.gdkWindows.get(xid));
|
||||
log.debug("gdkWinState="+gdkWinState+" for xid="+xid);
|
||||
// NOTE: Gecko 8.0 provides the 'sizemodechange' event
|
||||
if (gdkWinState === gdk.GDK_WINDOW_STATE_ICONIFIED) {
|
||||
log.debug("GOT ICONIFIED");
|
||||
@ -523,7 +541,7 @@ firetray.Window = {
|
||||
let hides_single_window = firetray.Utils.prefService.getBoolPref('hides_single_window');
|
||||
if (hides_on_minimize) {
|
||||
if (hides_single_window)
|
||||
firetray.Handler.hideWindow(xwin);
|
||||
firetray.Handler.hideWindow(xid);
|
||||
else
|
||||
firetray.Handler.hideAllWindows();
|
||||
}
|
||||
@ -573,8 +591,7 @@ firetray.Handler.registerWindow = function(win) {
|
||||
this.windowsCount += 1;
|
||||
// NOTE: no need to check for window state to set visibility because all
|
||||
// windows *are* shown at startup
|
||||
this.windows[xid].visible = true; // this.windows[xid].baseWin.visibility always true :-(
|
||||
this.visibleWindowsCount += 1;
|
||||
firetray.Window.updateVisibility(xid, true);
|
||||
log.debug("window "+xid+" registered");
|
||||
// NOTE: shouldn't be necessary to gtk_widget_add_events(gtkWin, gdk.GDK_ALL_EVENTS_MASK);
|
||||
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
var EXPORTED_SYMBOLS = [ "firetray" ];
|
||||
|
||||
const FIRETRAY_LOG_LEVEL = "All"; // "All" for debugging
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
const FIRETRAY_LOG_LEVEL = "Warn"; // "All" for debugging
|
||||
|
||||
const COLOR_NORMAL = "";
|
||||
const COLOR_RESET = "\033[m";
|
||||
const COLOR_BOLD = "\033[1m";
|
||||
@ -31,6 +31,17 @@ const COLOR_BG_BLUE = "\033[44m";
|
||||
const COLOR_BG_MAGENTA = "\033[45m";
|
||||
const COLOR_BG_CYAN = "\033[46m";
|
||||
|
||||
var colorTermLogColors = {
|
||||
"FATAL": COLOR_BOLD_RED,
|
||||
"ERROR": COLOR_RED,
|
||||
"WARN": COLOR_YELLOW,
|
||||
"INFO": COLOR_GREEN,
|
||||
"CONFIG": COLOR_MAGENTA,
|
||||
"DEBUG": COLOR_CYAN,
|
||||
"TRACE": COLOR_NORMAL,
|
||||
"ALL": COLOR_NORMAL
|
||||
};
|
||||
|
||||
if ("undefined" == typeof(firetray)) {
|
||||
var firetray = {};
|
||||
};
|
||||
@ -115,20 +126,7 @@ firetray.Logging = {
|
||||
__proto__: SimpleFormatter.prototype,
|
||||
|
||||
format: function(message) {
|
||||
let color = COLOR_NORMAL;
|
||||
|
||||
switch (message.levelDesc) {
|
||||
case "FATAL": color = COLOR_BOLD_RED; break;
|
||||
case "ERROR": color = COLOR_RED; break;
|
||||
case "WARN": color = COLOR_YELLOW; break;
|
||||
case "INFO": color = COLOR_GREEN; break;
|
||||
case "CONFIG": color = COLOR_MAGENTA; break;
|
||||
case "DEBUG": color = COLOR_BLUE; break;
|
||||
case "TRACE": color = COLOR_CYAN_; break;
|
||||
case "ALL": color = COLOR_NORMAL; break;
|
||||
default:
|
||||
};
|
||||
|
||||
let color = colorTermLogColors[message.levelDesc];
|
||||
let stringLog = SimpleFormatter.prototype.format.call(this, message);
|
||||
stringLog = color + stringLog + COLOR_RESET;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user