From a84f90ee187431698c08943fdefe434fb20eb3fd Mon Sep 17 00:00:00 2001 From: toofar Date: Thu, 28 Dec 2023 23:49:47 +1300 Subject: [PATCH] xxx: comment ifdefs back out, swap pos display, copy topleft Windows is being so inconsistent... --- src/tools/pin/pinwidget.cpp | 16 ++++++++-------- src/widgets/capture/capturewidget.cpp | 5 ++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/tools/pin/pinwidget.cpp b/src/tools/pin/pinwidget.cpp index 7c7748dbd8..d0c23aafb3 100644 --- a/src/tools/pin/pinwidget.cpp +++ b/src/tools/pin/pinwidget.cpp @@ -59,20 +59,20 @@ PinWidget::PinWidget(const QPixmap& pixmap, new QShortcut(Qt::Key_Escape, this, SLOT(close())); qreal devicePixelRatio = 1; -//#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX) +#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX) QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen(); if (currentScreen != nullptr) { devicePixelRatio = currentScreen->devicePixelRatio(); } -//#endif +#endif const int margin = static_cast(static_cast(MARGIN) * devicePixelRatio); QRect adjusted_pos = geometry + QMargins(margin, margin, margin, margin); debugText << QStringLiteral("orig geom: %1x%2+%3+%4") - .arg(geometry.x()) - .arg(geometry.y()) .arg(geometry.width()) .arg(geometry.height()) + .arg(geometry.x()) + .arg(geometry.y()) ; debugText << QStringLiteral("pixel ratio: %1").arg(devicePixelRatio); debugText << QStringLiteral("margin: %1") @@ -83,7 +83,7 @@ PinWidget::PinWidget(const QPixmap& pixmap, setWindowFlags(Qt::X11BypassWindowManagerHint); #endif -//#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX) +#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX) if (currentScreen != nullptr) { QPoint topLeft = currentScreen->geometry().topLeft(); adjusted_pos.setX((adjusted_pos.x() - topLeft.x()) / devicePixelRatio + @@ -96,13 +96,13 @@ PinWidget::PinWidget(const QPixmap& pixmap, resize(0, 0); move(adjusted_pos.x(), adjusted_pos.y()); debugText << QStringLiteral("adjusted geom: %1x%2+%3+%4") - .arg(adjusted_pos.x()) - .arg(adjusted_pos.y()) .arg(adjusted_pos.width()) .arg(adjusted_pos.height()) + .arg(adjusted_pos.x()) + .arg(adjusted_pos.y()) ; } -//#endif +#endif grabGesture(Qt::PinchGesture); this->setContextMenuPolicy(Qt::CustomContextMenu); diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index 98e72c4d9f..4fe96b2e66 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -470,7 +470,10 @@ void CaptureWidget::initHelpMessage() QList> keyMap; auto req = m_context.request; if (req.initialCaptureScreen() != nullptr) { - auto topLeft = req.initialCaptureScreen()->geometry().topLeft(); + QPoint topLeft( + req.initialCaptureScreen()->geometry().topLeft().x(), + req.initialCaptureScreen()->geometry().topLeft().y() + ); keyMap << QPair("Selected Screen Top Left", QStringLiteral("%1x%2").arg(topLeft.x()).arg(topLeft.y())); for (QScreen* const screen : QGuiApplication::screens()) { QPoint topLeftScreen = screen->geometry().topLeft();