Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/main/oshelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "oshelper.h"

#include <algorithm>
#include <unordered_set>

#include <QCoreApplication>
Expand All @@ -45,6 +46,8 @@
#include <QByteArray>
#include <QRandomGenerator>
#ifdef Q_OS_MAC
#include <QEventLoop>
#include <QThread>
#include "qt/macoshelper.h"
#endif
#ifdef Q_OS_WIN
Expand Down Expand Up @@ -74,6 +77,14 @@ QPixmap screenshot()
window->hide();
}
}

#if defined(Q_OS_MAC)
// Let Qt submit the native hide operations before blocking the GUI thread.
QGuiApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
// Give WindowServer time to finish removing the window.
QThread::msleep(100);
#endif

const auto unhide = sg::make_scope_guard([&hidden]() {
for (QWindow *window : hidden)
{
Expand Down Expand Up @@ -144,7 +155,7 @@ QList<QString> OSHelper::grabQrCodesFromScreen() const
}
catch (const std::exception &e)
{
qWarning() << e.what();
qWarning() << "QR screen capture: decoder exception:" << e.what();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: spacing before error text

}

return codes;
Expand Down
Loading