From 02aa83395051ddae2561a283903331476c572681 Mon Sep 17 00:00:00 2001 From: cg2121 Date: Tue, 1 Mar 2022 05:14:47 -0600 Subject: [PATCH] UI: Fix show/hide toggle with minimize to taskbar If the user would minimize to tray instead of taskbar, the window would flash when clicking show in the tray menu, and the preview would be disabled. This would only happen on Linux. --- UI/window-basic-main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index af263298b..ea943d742 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -4759,6 +4759,7 @@ void OBSBasic::changeEvent(QEvent *event) if (trayIcon && trayIcon->isVisible() && sysTrayMinimizeToTray()) { ToggleShowHide(); + return; } if (previewEnabled) @@ -8988,9 +8989,10 @@ void OBSBasic::SetShowing(bool showing) if (showHide) showHide->setText(QTStr("Basic.SystemTray.Show")); - QTimer::singleShot(250, this, SLOT(hide())); + QTimer::singleShot(0, this, SLOT(hide())); - setVisible(false); + if (previewEnabled) + EnablePreviewDisplay(false); #ifdef __APPLE__ EnableOSXDockIcon(false); @@ -8999,9 +9001,10 @@ void OBSBasic::SetShowing(bool showing) } else if (showing && !isVisible()) { if (showHide) showHide->setText(QTStr("Basic.SystemTray.Hide")); - QTimer::singleShot(250, this, SLOT(show())); + QTimer::singleShot(0, this, SLOT(show())); - setVisible(true); + if (previewEnabled) + EnablePreviewDisplay(true); #ifdef __APPLE__ EnableOSXDockIcon(true);