From c112ffc3fc6f64772cf3aacd0aa0fd922d5a79ac Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 5 Mar 2023 22:43:34 -0500 Subject: [PATCH] Fix temporary screencapture showing phantom windows * Fix #9200 --- src/gui/DatabaseOpenDialog.cpp | 1 + src/gui/MainWindow.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/DatabaseOpenDialog.cpp b/src/gui/DatabaseOpenDialog.cpp index 3eef249f1..acf905044 100644 --- a/src/gui/DatabaseOpenDialog.cpp +++ b/src/gui/DatabaseOpenDialog.cpp @@ -36,6 +36,7 @@ DatabaseOpenDialog::DatabaseOpenDialog(QWidget* parent) { setWindowTitle(tr("Unlock Database - KeePassXC")); setWindowFlags(Qt::Dialog); + setWindowFlag(Qt::WindowContextHelpButtonHint, false); #ifdef Q_OS_LINUX // Linux requires this to overcome some Desktop Environments (also no Quick Unlock) setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 3acfcb4a8..ea2ab4fc3 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1663,8 +1663,10 @@ void MainWindow::applySettingsChanges() void MainWindow::setAllowScreenCapture(bool state) { m_allowScreenCapture = state; - for (auto window : qApp->allWindows()) { - osUtils->setPreventScreenCapture(window, !m_allowScreenCapture); + for (auto window : qApp->topLevelWindows()) { + if (window->isVisible()) { + osUtils->setPreventScreenCapture(window, !m_allowScreenCapture); + } } m_ui->actionAllowScreenCapture->blockSignals(true); m_ui->actionAllowScreenCapture->setChecked(m_allowScreenCapture);