fix - MacOS - Strange tool buttons position behaviour on capture screen

(cherry picked from commit 0dee55884b873d6ded139c39d665bb229481c7e2)
This commit is contained in:
Yuriy Puchkov
2021-01-14 11:42:30 +02:00
committed by borgmanJeremy
parent 2fb3f90afc
commit 7b4c409a86

View File

@@ -146,6 +146,10 @@ CaptureWidget::CaptureWidget(const uint id,
updateButtons();
QVector<QRect> 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());