diff --git a/suite/mailnews/messenger.xul b/suite/mailnews/messenger.xul index 671342ee39..209b261566 100644 --- a/suite/mailnews/messenger.xul +++ b/suite/mailnews/messenger.xul @@ -27,7 +27,6 @@ onload="OnLoadMessenger()" onunload="OnUnloadMessenger()" onclose="return MailWindowIsClosing();" - style="width: 82em; height: 50em;" screenX="10" screenY="10" persist="width height screenX screenY sizemode" toggletoolbar="true" diff --git a/suite/mailnews/msgMail3PaneWindow.js b/suite/mailnews/msgMail3PaneWindow.js index f257acfff5..60eb0d2277 100644 --- a/suite/mailnews/msgMail3PaneWindow.js +++ b/suite/mailnews/msgMail3PaneWindow.js @@ -676,6 +676,28 @@ function OnLoadMessenger() verifyAccounts(null, false); msgDBCacheManager.init(); + // set the messenger default window size relative to the screen size + // initial default dimensions are 2/3 and 1/2 of the screen dimensions + if (!document.documentElement.hasAttribute("width")) { + let screenHeight = window.screen.availHeight; + let screenWidth = window.screen.availWidth; + let defaultHeight = Math.floor(screenHeight * 2 / 3); + let defaultWidth = Math.floor(screenWidth / 2); + + // minimum dimensions are 1024x768 less padding unless restrained by screen + const minHeight = 768; + const minWidth = 1024; + + if (defaultHeight < minHeight) + defaultHeight = Math.min(minHeight, screenHeight); + if (defaultWidth < minWidth) + defaultWidth = Math.min(minWidth, screenWidth); + + // keep some distance to the borders, accounting for window decoration + document.documentElement.setAttribute("height", defaultHeight - 48); + document.documentElement.setAttribute("width", defaultWidth - 24); + } + // initialize tabmail system - see tabmail.js and tabmail.xml for details let tabmail = GetTabMail(); tabmail.registerTabType(gMailNewsTabsType);