[Pkg-mozext-commits] [firetray] 307/399: correct visibility state when hidden application called from command line
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:24:04 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch dfsg-clean
in repository firetray.
commit 39f3c20fa89bae524517e3b018019a80d5087946
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Fri Sep 7 16:47:47 2012 +0200
correct visibility state when hidden application called from command line
---
src/modules/linux/FiretrayWindow.jsm | 41 ++++++++++++++++++++++++----------
src/modules/logging.jsm | 30 ++++++++++++-------------
2 files changed, 43 insertions(+), 28 deletions(-)
diff --git a/src/modules/linux/FiretrayWindow.jsm b/src/modules/linux/FiretrayWindow.jsm
index b8e1d98..8c4fbc7 100644
--- a/src/modules/linux/FiretrayWindow.jsm
+++ b/src/modules/linux/FiretrayWindow.jsm
@@ -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);
diff --git a/src/modules/logging.jsm b/src/modules/logging.jsm
index 28ce0d1..a275cf2 100644
--- a/src/modules/logging.jsm
+++ b/src/modules/logging.jsm
@@ -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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git
More information about the Pkg-mozext-commits
mailing list