Fix window shrinking on each launch (#3910)

This commit is contained in:
Abe Jellinek 2024-04-01 16:33:38 -04:00 committed by GitHub
parent 669574b484
commit a78d1c3876
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,22 +32,26 @@ if (platforms) {
else if (Zotero.isLinux && !platforms.includes("linux")) return;
}
// Set attributes that affect window chrome sizing immediately, to avoid shrinking when
// AppWindow::LoadPersistentWindowState() restores width/height
// https://searchfox.org/mozilla-central/rev/10f46c9c638e0e5935ed9fa12aadc9d0d4e71ade/xpfe/appshell/AppWindow.cpp#2582-2584
// Create tab bar by default
document.documentElement.setAttribute('drawintitlebar', true);
document.documentElement.setAttribute('tabsintitlebar', true);
if (Zotero.isMac) {
document.documentElement.setAttribute('chromemargin', '0,-1,-1,-1');
}
else {
document.documentElement.setAttribute('chromemargin', '0,2,2,2');
}
window.addEventListener("load", function () {
// Fix window without menubar/titlebar when Zotero is closed in full-screen mode in OS X 10.11+
if (Zotero.isMac && window.document.documentElement.getAttribute('sizemode') == 'fullscreen') {
window.document.documentElement.setAttribute('sizemode', 'normal');
}
// Create tab bar by default
document.documentElement.setAttribute('drawintitlebar', true);
document.documentElement.setAttribute('tabsintitlebar', true);
if (Zotero.isMac) {
document.documentElement.setAttribute('chromemargin', '0,-1,-1,-1');
}
else {
document.documentElement.setAttribute('chromemargin', '0,2,2,2');
}
if (Zotero.isWin) {
let windowIcon = document.querySelector(".titlebar-icon");
// Simulate Windows window control