mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 384336 - Maximize the browser window on first run on small screens. r=MattN
This commit is contained in:
parent
2931bad5d8
commit
0112375779
@ -1020,41 +1020,17 @@ var gBrowserInit = {
|
||||
|
||||
// Set a sane starting width/height for all resolutions on new profiles.
|
||||
if (!document.documentElement.hasAttribute("width")) {
|
||||
let defaultWidth;
|
||||
let defaultHeight;
|
||||
const TARGET_WIDTH = 1280;
|
||||
const TARGET_HEIGHT = 1040;
|
||||
let width = Math.min(screen.availWidth * .9, TARGET_WIDTH);
|
||||
let height = Math.min(screen.availHeight * .9, TARGET_HEIGHT);
|
||||
|
||||
// Very small: maximize the window
|
||||
// Portrait : use about full width and 3/4 height, to view entire pages
|
||||
// at once (without being obnoxiously tall)
|
||||
// Widescreen: use about half width, to suggest side-by-side page view
|
||||
// Otherwise : use 3/4 height and width
|
||||
if (screen.availHeight <= 600) {
|
||||
document.documentElement.setAttribute("width", width);
|
||||
document.documentElement.setAttribute("height", height);
|
||||
|
||||
if (width < TARGET_WIDTH && height < TARGET_HEIGHT) {
|
||||
document.documentElement.setAttribute("sizemode", "maximized");
|
||||
defaultWidth = 610;
|
||||
defaultHeight = 450;
|
||||
}
|
||||
else {
|
||||
if (screen.availWidth <= screen.availHeight) {
|
||||
defaultWidth = screen.availWidth * .9;
|
||||
defaultHeight = screen.availHeight * .75;
|
||||
}
|
||||
else if (screen.availWidth >= 2048) {
|
||||
defaultWidth = (screen.availWidth / 2) - 20;
|
||||
defaultHeight = screen.availHeight - 10;
|
||||
}
|
||||
else {
|
||||
defaultWidth = screen.availWidth * .75;
|
||||
defaultHeight = screen.availHeight * .75;
|
||||
}
|
||||
|
||||
#if MOZ_WIDGET_GTK == 2
|
||||
// On X, we're not currently able to account for the size of the window
|
||||
// border. Use 28px as a guess (titlebar + bottom window border)
|
||||
defaultHeight -= 28;
|
||||
#endif
|
||||
}
|
||||
document.documentElement.setAttribute("width", defaultWidth);
|
||||
document.documentElement.setAttribute("height", defaultHeight);
|
||||
}
|
||||
|
||||
if (!window.toolbar.visible) {
|
||||
|
Loading…
Reference in New Issue
Block a user