mirror of
https://github.com/moparisthebest/FireTray
synced 2024-12-22 13:58:48 -05:00
base the startup event on the first 'before-first-paint'
That lets the windows get well realized before we can hide them (start_hidden). This is especially true for heavy configurations with numerous addons (Lightning with multiple remote calendars for instance).
This commit is contained in:
parent
c622e61e9d
commit
29de64e51f
@ -24,9 +24,6 @@ var firetrayChrome = { // each new window gets a new firetrayChrome !
|
|||||||
|
|
||||||
ftlog.debug("ONLOAD"); firetray.Handler.dumpWindows();
|
ftlog.debug("ONLOAD"); firetray.Handler.dumpWindows();
|
||||||
this.winId = firetray.Handler.registerWindow(win);
|
this.winId = firetray.Handler.registerWindow(win);
|
||||||
win.setTimeout(firetrayChrome.startHiddenMaybe,
|
|
||||||
FIRETRAY_DELAY_STARTUP_HIDE_MILLISECONDS,
|
|
||||||
this.winId);
|
|
||||||
|
|
||||||
win.addEventListener('close', firetrayChrome.onClose, true);
|
win.addEventListener('close', firetrayChrome.onClose, true);
|
||||||
|
|
||||||
@ -69,15 +66,6 @@ var firetrayChrome = { // each new window gets a new firetrayChrome !
|
|||||||
firetray.Handler.hideAllWindows();
|
firetray.Handler.hideAllWindows();
|
||||||
event && event.preventDefault();
|
event && event.preventDefault();
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
startHiddenMaybe: function(winId) {
|
|
||||||
ftlog.debug('startHiddenMaybe'+'. appStarted='+firetray.Handler.appStarted);
|
|
||||||
|
|
||||||
if (firetray.Utils.prefService.getBoolPref('start_hidden') &&
|
|
||||||
!firetray.Handler.appStarted) { // !appStarted for new windows !
|
|
||||||
firetray.Handler.startupHideWindow(winId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -43,7 +43,6 @@ firetray.Handler = {
|
|||||||
|
|
||||||
appId: (function(){return Services.appinfo.ID;})(),
|
appId: (function(){return Services.appinfo.ID;})(),
|
||||||
appName: (function(){return Services.appinfo.name;})(),
|
appName: (function(){return Services.appinfo.name;})(),
|
||||||
appStartupTopic: null,
|
|
||||||
runtimeABI: (function(){return Services.appinfo.XPCOMABI;})(),
|
runtimeABI: (function(){return Services.appinfo.XPCOMABI;})(),
|
||||||
runtimeOS: (function(){return Services.appinfo.OS;})(), // "WINNT", "Linux", "Darwin"
|
runtimeOS: (function(){return Services.appinfo.OS;})(), // "WINNT", "Linux", "Darwin"
|
||||||
addonRootDir: (function(){
|
addonRootDir: (function(){
|
||||||
@ -116,9 +115,8 @@ firetray.Handler = {
|
|||||||
firetray.Chat.init();
|
firetray.Chat.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.appStartupTopic = this.getAppStartupTopic(this.appId);
|
firetray.Utils.addObservers(firetray.Handler,
|
||||||
firetray.Utils.addObservers(firetray.Handler, [ this.appStartupTopic,
|
[ "before-first-paint", "xpcom-will-shutdown", "profile-change-teardown" ]);
|
||||||
"xpcom-will-shutdown", "profile-change-teardown" ]);
|
|
||||||
|
|
||||||
this.preventWarnOnClose();
|
this.preventWarnOnClose();
|
||||||
|
|
||||||
@ -190,18 +188,22 @@ firetray.Handler = {
|
|||||||
|
|
||||||
observe: function(subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
switch (topic) {
|
switch (topic) {
|
||||||
case "sessionstore-windows-restored":
|
|
||||||
case "mail-startup-done":
|
case "before-first-paint":
|
||||||
case "final-ui-startup": // subject=ChromeWindow
|
log.debug("before-first-paint: "+subject.baseURI);
|
||||||
if (firetray.Handler.appStarted) return; // second TB window issues "mail-startup-done"
|
firetray.Utils.removeObservers(firetray.Handler, [ "before-first-paint" ]);
|
||||||
log.debug("RECEIVED: "+topic+", launching timer");
|
|
||||||
// sessionstore-windows-restored does not come after the realization of
|
|
||||||
// all windows... so we wait a little
|
|
||||||
firetray.Utils.timer(function() {
|
firetray.Utils.timer(function() {
|
||||||
|
|
||||||
|
if (firetray.Utils.prefService.getBoolPref('start_hidden')) {
|
||||||
|
log.debug("start_hidden");
|
||||||
|
firetray.Handler.hideAllWindows();
|
||||||
|
}
|
||||||
|
|
||||||
firetray.Handler.appStarted = true;
|
firetray.Handler.appStarted = true;
|
||||||
log.debug("*** appStarted ***");
|
log.debug("*** appStarted ***");
|
||||||
}, FIRETRAY_DELAY_BROWSER_STARTUP_MILLISECONDS, Ci.nsITimer.TYPE_ONE_SHOT);
|
}, FIRETRAY_DELAY_BROWSER_STARTUP_MILLISECONDS, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "xpcom-will-shutdown":
|
case "xpcom-will-shutdown":
|
||||||
log.debug("xpcom-will-shutdown");
|
log.debug("xpcom-will-shutdown");
|
||||||
this.shutdown();
|
this.shutdown();
|
||||||
@ -225,18 +227,6 @@ firetray.Handler = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getAppStartupTopic: function(id) {
|
|
||||||
switch (id) {
|
|
||||||
case FIRETRAY_FIREFOX_ID:
|
|
||||||
case FIRETRAY_SEAMONKEY_ID:
|
|
||||||
return 'sessionstore-windows-restored';
|
|
||||||
case FIRETRAY_THUNDERBIRD_ID:
|
|
||||||
return 'mail-startup-done';
|
|
||||||
default:
|
|
||||||
return 'final-ui-startup';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// these get overridden in OS-specific Icon/Window handlers
|
// these get overridden in OS-specific Icon/Window handlers
|
||||||
setIconImageDefault: function() {},
|
setIconImageDefault: function() {},
|
||||||
setIconImageNewMail: function() {},
|
setIconImageNewMail: function() {},
|
||||||
@ -249,7 +239,6 @@ firetray.Handler = {
|
|||||||
unregisterWindow: function(win) {},
|
unregisterWindow: function(win) {},
|
||||||
getWindowIdFromChromeWindow: function(win) {},
|
getWindowIdFromChromeWindow: function(win) {},
|
||||||
hideWindow: function(winId) {},
|
hideWindow: function(winId) {},
|
||||||
startupHideWindow: function(winId) {},
|
|
||||||
showWindow: function(winId) {},
|
showWindow: function(winId) {},
|
||||||
showHideAllWindows: function() {},
|
showHideAllWindows: function() {},
|
||||||
activateLastWindow: function(gtkStatusIcon, gdkEvent, userData) {},
|
activateLastWindow: function(gtkStatusIcon, gdkEvent, userData) {},
|
||||||
|
@ -11,7 +11,6 @@ var EXPORTED_SYMBOLS =
|
|||||||
"FIRETRAY_IM_STATUS_AVAILABLE", "FIRETRAY_IM_STATUS_AWAY",
|
"FIRETRAY_IM_STATUS_AVAILABLE", "FIRETRAY_IM_STATUS_AWAY",
|
||||||
"FIRETRAY_IM_STATUS_BUSY", "FIRETRAY_IM_STATUS_OFFLINE",
|
"FIRETRAY_IM_STATUS_BUSY", "FIRETRAY_IM_STATUS_OFFLINE",
|
||||||
"FIRETRAY_ACCOUNT_SERVER_TYPE_IM",
|
"FIRETRAY_ACCOUNT_SERVER_TYPE_IM",
|
||||||
"FIRETRAY_DELAY_STARTUP_HIDE_MILLISECONDS",
|
|
||||||
"FIRETRAY_DELAY_BROWSER_STARTUP_MILLISECONDS",
|
"FIRETRAY_DELAY_BROWSER_STARTUP_MILLISECONDS",
|
||||||
"FIRETRAY_DELAY_NOWAIT_MILLISECONDS",
|
"FIRETRAY_DELAY_NOWAIT_MILLISECONDS",
|
||||||
"FIRETRAY_DELAY_PREF_CLEANING_MILLISECONDS",
|
"FIRETRAY_DELAY_PREF_CLEANING_MILLISECONDS",
|
||||||
@ -49,7 +48,6 @@ const FIRETRAY_IM_STATUS_OFFLINE = "user-offline";
|
|||||||
const FIRETRAY_ACCOUNT_SERVER_TYPE_IM = "im";
|
const FIRETRAY_ACCOUNT_SERVER_TYPE_IM = "im";
|
||||||
|
|
||||||
const FIRETRAY_DELAY_BROWSER_STARTUP_MILLISECONDS = 500;
|
const FIRETRAY_DELAY_BROWSER_STARTUP_MILLISECONDS = 500;
|
||||||
const FIRETRAY_DELAY_STARTUP_HIDE_MILLISECONDS = 400;
|
|
||||||
const FIRETRAY_DELAY_NOWAIT_MILLISECONDS = 0;
|
const FIRETRAY_DELAY_NOWAIT_MILLISECONDS = 0;
|
||||||
const FIRETRAY_DELAY_PREF_CLEANING_MILLISECONDS = 15*60*1000;
|
const FIRETRAY_DELAY_PREF_CLEANING_MILLISECONDS = 15*60*1000;
|
||||||
|
|
||||||
|
@ -257,16 +257,6 @@ firetray.Window = {
|
|||||||
firetray.Handler.showHideIcon();
|
firetray.Handler.showHideIcon();
|
||||||
},
|
},
|
||||||
|
|
||||||
startupHide: function(xid) {
|
|
||||||
log.debug('startupHide: '+xid);
|
|
||||||
|
|
||||||
firetray.Handler.windows[xid].baseWin.visibility = false;
|
|
||||||
firetray.Window.updateVisibility(xid, false);
|
|
||||||
|
|
||||||
firetray.PopupMenu.showWindowItem(xid);
|
|
||||||
firetray.Handler.showHideIcon();
|
|
||||||
},
|
|
||||||
|
|
||||||
savePositionAndSize: function(xid) {
|
savePositionAndSize: function(xid) {
|
||||||
let gx = {}, gy = {}, gwidth = {}, gheight = {};
|
let gx = {}, gy = {}, gwidth = {}, gheight = {};
|
||||||
firetray.Handler.windows[xid].baseWin.getPositionAndSize(gx, gy, gwidth, gheight);
|
firetray.Handler.windows[xid].baseWin.getPositionAndSize(gx, gy, gwidth, gheight);
|
||||||
@ -533,7 +523,7 @@ firetray.Window = {
|
|||||||
case x11.MapNotify:
|
case x11.MapNotify:
|
||||||
log.debug("MapNotify");
|
log.debug("MapNotify");
|
||||||
let win = firetray.Handler.windows[xid];
|
let win = firetray.Handler.windows[xid];
|
||||||
if (!win.visible) { // happens when hidden app called from command line
|
if (!win.visible && firetray.Handler.appStarted) { // happens when hidden app called from command line
|
||||||
log.warn("window not visible, correcting visibility");
|
log.warn("window not visible, correcting visibility");
|
||||||
firetray.Window.updateVisibility(xid, true);
|
firetray.Window.updateVisibility(xid, true);
|
||||||
log.debug("visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
|
log.debug("visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
|
||||||
@ -635,7 +625,6 @@ firetray.Handler.unregisterWindow = function(win) {
|
|||||||
|
|
||||||
firetray.Handler.showWindow = firetray.Window.show;
|
firetray.Handler.showWindow = firetray.Window.show;
|
||||||
firetray.Handler.hideWindow = firetray.Window.hide;
|
firetray.Handler.hideWindow = firetray.Window.hide;
|
||||||
firetray.Handler.startupHideWindow = firetray.Window.startupHide;
|
|
||||||
|
|
||||||
firetray.Handler.showHideAllWindows = function(gtkStatusIcon, userData) {
|
firetray.Handler.showHideAllWindows = function(gtkStatusIcon, userData) {
|
||||||
log.debug("showHideAllWindows: "+userData);
|
log.debug("showHideAllWindows: "+userData);
|
||||||
|
Loading…
Reference in New Issue
Block a user