[Pkg-mozext-commits] [firetray] 385/399: * fix: correct launch of app-started event in Thunderbird when windows not actually mapped (or "mapped" to another desktop) * check app started if -firetrayShowHide or -firetrayPresent
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:24:19 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 ef30cd16e236fc0a8303acc0b83b1ea6f9bc72a7
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Sun Oct 6 19:01:49 2013 +0200
* fix: correct launch of app-started event in Thunderbird when windows not
actually mapped (or "mapped" to another desktop)
* check app started if -firetrayShowHide or -firetrayPresent
We can't base the app-started event solely on MapNotify, at least because the
app could be started on another desktop (not mapped). The app-started event in
Thunderbird is not based on mail-startup-done events. We might have to consider
implementing a watchdog for unexpected cases...
---
src/components/firetray-clhandler.js | 40 +++++++++++++++++++++++++++-------
src/modules/FiretrayChat.jsm | 17 +++++++--------
src/modules/FiretrayHandler.jsm | 10 +++++++++
src/modules/linux/FiretrayWindow.jsm | 16 ++++++--------
4 files changed, 57 insertions(+), 26 deletions(-)
diff --git a/src/components/firetray-clhandler.js b/src/components/firetray-clhandler.js
index 53bd2a4..51970d9 100644
--- a/src/components/firetray-clhandler.js
+++ b/src/components/firetray-clhandler.js
@@ -27,16 +27,40 @@ firetayCommandLineHandler.prototype = {
/* nsICommandLineHandler */
handle: function clh_handle(cmdLine)
{
- if (cmdLine.handleFlag("firetrayShowHide", false)) {
- log.debug("*** CmdLine call -firetrayShowHide ***");
- firetray.Handler.showHideAllWindows();
- cmdLine.preventDefault = true;
- } else if (cmdLine.handleFlag("firetrayPresent", false)) {
- log.debug("*** CmdLine call -firetrayPresent ***");
- firetray.Handler.showAllWindowsAndActivate();
- cmdLine.preventDefault = true;
+ function RuntimeException(message) {
+ this.message = message;
+ this.name = "RuntimeException";
+ }
+
+ function checkAppStarted() {
+ if (!firetray.Handler.appStarted) {
+ let msg = "application not started: doing nothing.";
+ log.warn(msg);
+ throw new RuntimeException(msg);
+ }
+ }
+
+ try {
+
+ if (cmdLine.handleFlag("firetrayShowHide", false)) {
+ checkAppStarted();
+ log.debug("*** CmdLine call -firetrayShowHide ***");
+ firetray.Handler.showHideAllWindows();
+ cmdLine.preventDefault = true;
+
+ } else if (cmdLine.handleFlag("firetrayPresent", false)) {
+ checkAppStarted();
+ log.debug("*** CmdLine call -firetrayPresent ***");
+ firetray.Handler.showAllWindowsAndActivate();
+ cmdLine.preventDefault = true;
+ }
+ } catch(e) {
+ if (e instanceof RuntimeException) {
+ cmdLine.preventDefault = true;
+ return;
+ }
}
},
diff --git a/src/modules/FiretrayChat.jsm b/src/modules/FiretrayChat.jsm
index 7781470..b5e7d01 100644
--- a/src/modules/FiretrayChat.jsm
+++ b/src/modules/FiretrayChat.jsm
@@ -277,24 +277,23 @@ firetray.Chat = {
let iconName;
switch (userStatus) {
- case Ci.imIStatusInfo.STATUS_OFFLINE: // 1
+ case Ci.imIStatusInfo.STATUS_OFFLINE: // 1
iconName = FIRETRAY_IM_STATUS_OFFLINE;
break;
- case Ci.imIStatusInfo.STATUS_IDLE: // 4
- case Ci.imIStatusInfo.STATUS_AWAY: // 5
+ case Ci.imIStatusInfo.STATUS_IDLE: // 4
+ case Ci.imIStatusInfo.STATUS_AWAY: // 5
iconName = FIRETRAY_IM_STATUS_AWAY;
break;
- case Ci.imIStatusInfo.STATUS_AVAILABLE: // 7
+ case Ci.imIStatusInfo.STATUS_AVAILABLE: // 7
iconName = FIRETRAY_IM_STATUS_AVAILABLE;
break;
case Ci.imIStatusInfo.STATUS_UNAVAILABLE: // 6
iconName = FIRETRAY_IM_STATUS_BUSY;
break;
- case Ci.imIStatusInfo.STATUS_UNKNOWN: // 0
- case Ci.imIStatusInfo.STATUS_INVISIBLE: // 2
- case Ci.imIStatusInfo.STATUS_MOBILE: // 3
- default:
- // ignore
+ case Ci.imIStatusInfo.STATUS_UNKNOWN: // 0
+ case Ci.imIStatusInfo.STATUS_INVISIBLE: // 2
+ case Ci.imIStatusInfo.STATUS_MOBILE: // 3
+ default: // ignore
}
log.debug("IM status changed="+iconName);
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index b79e4bf..b43cdd7 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -135,6 +135,7 @@ firetray.Handler = {
log.error("session file could not be read");
this.restoredWindowsCount = 1; // default
}
+ firetray.Utils.addObservers(firetray.Handler, [ "mail-startup-done" ]);
} else {
firetray.Utils.addObservers(firetray.Handler, [ "final-ui-startup" ]);
}
@@ -248,6 +249,15 @@ firetray.Handler = {
firetray.Handler.startupDone();
break;
+ case "mail-startup-done": // or xul-window-visible, mail-tabs-session-restored ?
+ log.info(topic+": "+subject+","+data);
+ if (firetray.Handler.restoredWindowsCount &&
+ !--firetray.Handler.restoredWindowsCount) {
+ firetray.Utils.removeObservers(firetray.Handler, [ topic ]);
+ firetray.Handler.startupDone();
+ }
+ break;
+
case "xpcom-will-shutdown":
log.debug("xpcom-will-shutdown");
this.shutdown();
diff --git a/src/modules/linux/FiretrayWindow.jsm b/src/modules/linux/FiretrayWindow.jsm
index e9bcf77..4f474db 100644
--- a/src/modules/linux/FiretrayWindow.jsm
+++ b/src/modules/linux/FiretrayWindow.jsm
@@ -595,16 +595,12 @@ firetray.Window = {
let xid = xany.contents.window;
if (xany.contents.type === x11.MapNotify) {
- if (!firetray.Handler.appStarted &&
- firetray.Utils.prefService.getBoolPref('start_hidden')) {
+ gdk.gdk_window_remove_filter(firetray.Handler.gdkWindows.get(xid),
+ firetray.Handler.windows[xid].startupFilterCb, null);
+ if (firetray.Utils.prefService.getBoolPref('start_hidden')) {
log.debug("start_hidden");
- if (firetray.Handler.restoredWindowsCount &&
- !--firetray.Handler.restoredWindowsCount)
- firetray.Handler.startupDone();
firetray.Window.startupHide(xid);
}
- gdk.gdk_window_remove_filter(firetray.Handler.gdkWindows.get(xid),
- firetray.Handler.windows[xid].startupFilterCb, null);
}
return gdk.GDK_FILTER_CONTINUE;
@@ -699,8 +695,10 @@ firetray.Handler.registerWindow = function(win) {
this.windows[xid].filterWindowCb = gdk.GdkFilterFunc_t(firetray.Window.filterWindow);
gdk.gdk_window_add_filter(gdkWin, this.windows[xid].filterWindowCb, null);
- this.windows[xid].startupFilterCb = gdk.GdkFilterFunc_t(firetray.Window.startupFilter);
- gdk.gdk_window_add_filter(gdkWin, this.windows[xid].startupFilterCb, null);
+ if (!firetray.Handler.appStarted) {
+ this.windows[xid].startupFilterCb = gdk.GdkFilterFunc_t(firetray.Window.startupFilter);
+ gdk.gdk_window_add_filter(gdkWin, this.windows[xid].startupFilterCb, null);
+ }
firetray.Window.attachOnFocusInCallback(xid);
if (firetray.Handler.isChatEnabled() && firetray.Chat.initialized) {
--
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