* 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...
This commit is contained in:
parent
d8536d8127
commit
ef30cd16e2
|
@ -27,16 +27,40 @@ firetayCommandLineHandler.prototype = {
|
||||||
/* nsICommandLineHandler */
|
/* nsICommandLineHandler */
|
||||||
handle: function clh_handle(cmdLine)
|
handle: function clh_handle(cmdLine)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
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)) {
|
if (cmdLine.handleFlag("firetrayShowHide", false)) {
|
||||||
|
checkAppStarted();
|
||||||
log.debug("*** CmdLine call -firetrayShowHide ***");
|
log.debug("*** CmdLine call -firetrayShowHide ***");
|
||||||
firetray.Handler.showHideAllWindows();
|
firetray.Handler.showHideAllWindows();
|
||||||
cmdLine.preventDefault = true;
|
cmdLine.preventDefault = true;
|
||||||
|
|
||||||
} else if (cmdLine.handleFlag("firetrayPresent", false)) {
|
} else if (cmdLine.handleFlag("firetrayPresent", false)) {
|
||||||
|
checkAppStarted();
|
||||||
log.debug("*** CmdLine call -firetrayPresent ***");
|
log.debug("*** CmdLine call -firetrayPresent ***");
|
||||||
firetray.Handler.showAllWindowsAndActivate();
|
firetray.Handler.showAllWindowsAndActivate();
|
||||||
cmdLine.preventDefault = true;
|
cmdLine.preventDefault = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(e) {
|
||||||
|
if (e instanceof RuntimeException) {
|
||||||
|
cmdLine.preventDefault = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -293,8 +293,7 @@ firetray.Chat = {
|
||||||
case Ci.imIStatusInfo.STATUS_UNKNOWN: // 0
|
case Ci.imIStatusInfo.STATUS_UNKNOWN: // 0
|
||||||
case Ci.imIStatusInfo.STATUS_INVISIBLE: // 2
|
case Ci.imIStatusInfo.STATUS_INVISIBLE: // 2
|
||||||
case Ci.imIStatusInfo.STATUS_MOBILE: // 3
|
case Ci.imIStatusInfo.STATUS_MOBILE: // 3
|
||||||
default:
|
default: // ignore
|
||||||
// ignore
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("IM status changed="+iconName);
|
log.debug("IM status changed="+iconName);
|
||||||
|
|
|
@ -135,6 +135,7 @@ firetray.Handler = {
|
||||||
log.error("session file could not be read");
|
log.error("session file could not be read");
|
||||||
this.restoredWindowsCount = 1; // default
|
this.restoredWindowsCount = 1; // default
|
||||||
}
|
}
|
||||||
|
firetray.Utils.addObservers(firetray.Handler, [ "mail-startup-done" ]);
|
||||||
} else {
|
} else {
|
||||||
firetray.Utils.addObservers(firetray.Handler, [ "final-ui-startup" ]);
|
firetray.Utils.addObservers(firetray.Handler, [ "final-ui-startup" ]);
|
||||||
}
|
}
|
||||||
|
@ -248,6 +249,15 @@ firetray.Handler = {
|
||||||
firetray.Handler.startupDone();
|
firetray.Handler.startupDone();
|
||||||
break;
|
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":
|
case "xpcom-will-shutdown":
|
||||||
log.debug("xpcom-will-shutdown");
|
log.debug("xpcom-will-shutdown");
|
||||||
this.shutdown();
|
this.shutdown();
|
||||||
|
|
|
@ -595,16 +595,12 @@ firetray.Window = {
|
||||||
let xid = xany.contents.window;
|
let xid = xany.contents.window;
|
||||||
|
|
||||||
if (xany.contents.type === x11.MapNotify) {
|
if (xany.contents.type === x11.MapNotify) {
|
||||||
if (!firetray.Handler.appStarted &&
|
|
||||||
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),
|
gdk.gdk_window_remove_filter(firetray.Handler.gdkWindows.get(xid),
|
||||||
firetray.Handler.windows[xid].startupFilterCb, null);
|
firetray.Handler.windows[xid].startupFilterCb, null);
|
||||||
|
if (firetray.Utils.prefService.getBoolPref('start_hidden')) {
|
||||||
|
log.debug("start_hidden");
|
||||||
|
firetray.Window.startupHide(xid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return gdk.GDK_FILTER_CONTINUE;
|
return gdk.GDK_FILTER_CONTINUE;
|
||||||
|
@ -699,8 +695,10 @@ firetray.Handler.registerWindow = function(win) {
|
||||||
|
|
||||||
this.windows[xid].filterWindowCb = gdk.GdkFilterFunc_t(firetray.Window.filterWindow);
|
this.windows[xid].filterWindowCb = gdk.GdkFilterFunc_t(firetray.Window.filterWindow);
|
||||||
gdk.gdk_window_add_filter(gdkWin, this.windows[xid].filterWindowCb, null);
|
gdk.gdk_window_add_filter(gdkWin, this.windows[xid].filterWindowCb, null);
|
||||||
|
if (!firetray.Handler.appStarted) {
|
||||||
this.windows[xid].startupFilterCb = gdk.GdkFilterFunc_t(firetray.Window.startupFilter);
|
this.windows[xid].startupFilterCb = gdk.GdkFilterFunc_t(firetray.Window.startupFilter);
|
||||||
gdk.gdk_window_add_filter(gdkWin, this.windows[xid].startupFilterCb, null);
|
gdk.gdk_window_add_filter(gdkWin, this.windows[xid].startupFilterCb, null);
|
||||||
|
}
|
||||||
|
|
||||||
firetray.Window.attachOnFocusInCallback(xid);
|
firetray.Window.attachOnFocusInCallback(xid);
|
||||||
if (firetray.Handler.isChatEnabled() && firetray.Chat.initialized) {
|
if (firetray.Handler.isChatEnabled() && firetray.Chat.initialized) {
|
||||||
|
|
Loading…
Reference in New Issue