Harden main-window geometry restoration

Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Loren Eteval
2026-08-17 15:51:50 +08:00
parent cc42f07e19
commit 9bb1ffec11
+8 -2
View File
@@ -241,7 +241,10 @@ class MainWindow(AppQMainWindow):
windowSize = AppSettings.get('ServerWidgetWindowSize').split(',')
width, height = tuple(int(size) for size in windowSize)
if (width, height) == (640, 480):
# TODO: write better condition
# (640, 480) is the size without navigation bar on macOS
# (702, 480) is the size with navigation bar on macOS
if (width, height) in ((640, 480), (702, 480)):
self.resize(self.DEFAULT_WINDOW_SIZE)
else:
self.resize(width, height)
@@ -269,7 +272,10 @@ class MainWindow(AppQMainWindow):
size = self.size()
if size == QtCore.QSize(640, 480):
# TODO: write better condition
# (640, 480) is the size without navigation bar on macOS
# (702, 480) is the size with navigation bar on macOS
if size in (QtCore.QSize(640, 480), QtCore.QSize(702, 480)):
logger.error(
f'detected unresolved Qt bug on macOS. '
f'Resizing main window to default '