From bf9c1b3205c59acca85dd75451146d15945668dd Mon Sep 17 00:00:00 2001 From: Joan Bruguera Date: Sun, 11 Mar 2018 14:05:07 +0100 Subject: [PATCH] Cover the fix/WA for Linux #1595 behind compile time flags & comment. --- src/gui/MainWindow.cpp | 6 ++++++ src/main.cpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 3c780fa15..f773e15b8 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -971,6 +971,12 @@ void MainWindow::trayIconTriggered(QSystemTrayIcon::ActivationReason reason) void MainWindow::hideWindow() { saveWindowInformation(); +#ifndef Q_OS_LINUX + // On some Linux systems, the window should NOT be minimized and hidden (i.e. not shown), at + // the same time (which would happen if both minimize on startup and minimize to tray are set) + // since otherwise it causes problems on restore as seen on issue #1595. Hiding it is enough. + setWindowState(windowState() | Qt::WindowMinimized); +#endif QTimer::singleShot(0, this, SLOT(hide())); if (config()->get("security/lockdatabaseminimize").toBool()) { diff --git a/src/main.cpp b/src/main.cpp index f09e80dfe..b3b607f25 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -127,7 +127,14 @@ int main(int argc, char** argv) // start minimized if configured bool minimizeOnStartup = config()->get("GUI/MinimizeOnStartup").toBool(); bool minimizeToTray = config()->get("GUI/MinimizeToTray").toBool(); +#ifndef Q_OS_LINUX + if (minimizeOnStartup) { +#else + // On some Linux systems, the window should NOT be minimized and hidden (i.e. not shown), at + // the same time (which would happen if both minimize on startup and minimize to tray are set) + // since otherwise it causes problems on restore as seen on issue #1595. Hiding it is enough. if (minimizeOnStartup && !minimizeToTray) { +#endif mainWindow.setWindowState(Qt::WindowMinimized); } if (!(minimizeOnStartup && minimizeToTray)) {