From 7b4c409a8694b25f20f653e408948e2551c14e72 Mon Sep 17 00:00:00 2001 From: Yuriy Puchkov Date: Thu, 14 Jan 2021 11:42:30 +0200 Subject: [PATCH] fix - MacOS - Strange tool buttons position behaviour on capture screen (cherry picked from commit 0dee55884b873d6ded139c39d665bb229481c7e2) --- src/widgets/capture/capturewidget.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index b237ff2e..a7e430d5 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -146,6 +146,10 @@ CaptureWidget::CaptureWidget(const uint id, updateButtons(); QVector areas; if (m_context.fullscreen) { +#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ + defined(Q_OS_MACX)) + QPoint currentPos = QCursor::pos(); +#endif for (QScreen* const screen : QGuiApplication::screens()) { QRect r = screen->geometry(); r.moveTo(r.x() / screen->devicePixelRatio(), @@ -153,7 +157,21 @@ CaptureWidget::CaptureWidget(const uint id, #if defined(Q_OS_WIN) r.moveTo(r.topLeft() - topLeft); #endif +#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ + defined(Q_OS_MACX)) + // MacOS works just with one active display, so we need to append + // just one current display and keep multiple displays logic for + // other OS + if (r.contains(currentPos)) { + // all calculations are processed according to (0, 0) start + // point so we need to move current object to (0, 0) + r.moveTo(0, 0); + areas.append(r); + break; + } +#else areas.append(r); +#endif } } else { areas.append(rect());