mirror of
https://github.com/moparisthebest/FireTray
synced 2025-01-08 12:08:05 -05:00
* 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 */
|
||||
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;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user