UI: Fix preview not being disabled when minimized

master
Richard Stanway 2020-02-13 22:54:22 +01:00
parent 6970cc32c2
commit 42ed6ffffb
1 changed files with 16 additions and 9 deletions

View File

@ -3925,11 +3925,24 @@ void OBSBasic::closeEvent(QCloseEvent *event)
void OBSBasic::changeEvent(QEvent *event)
{
if (event->type() == QEvent::WindowStateChange && isMinimized() &&
trayIcon && trayIcon->isVisible() && sysTrayMinimizeToTray()) {
if (event->type() == QEvent::WindowStateChange) {
QWindowStateChangeEvent *stateEvent =
(QWindowStateChangeEvent *)event;
if (isMinimized()) {
if (trayIcon && trayIcon->isVisible() &&
sysTrayMinimizeToTray()) {
ToggleShowHide();
}
if (previewEnabled)
EnablePreviewDisplay(false);
} else if (stateEvent->oldState() == Qt::WindowMinimized &&
isVisible()) {
if (previewEnabled)
EnablePreviewDisplay(true);
}
}
}
void OBSBasic::on_actionShow_Recordings_triggered()
@ -6917,9 +6930,6 @@ void OBSBasic::SetShowing(bool showing)
showHide->setText(QTStr("Basic.SystemTray.Show"));
QTimer::singleShot(250, this, SLOT(hide()));
if (previewEnabled)
EnablePreviewDisplay(false);
setVisible(false);
#ifdef __APPLE__
@ -6931,9 +6941,6 @@ void OBSBasic::SetShowing(bool showing)
showHide->setText(QTStr("Basic.SystemTray.Hide"));
QTimer::singleShot(250, this, SLOT(show()));
if (previewEnabled)
EnablePreviewDisplay(true);
setVisible(true);
#ifdef __APPLE__