From 5b1b0d9fbbffff0707bfa7ebe599332a539c7337 Mon Sep 17 00:00:00 2001 From: toofar Date: Thu, 28 Dec 2023 21:13:12 +1300 Subject: [PATCH] wip: maybe fix windows initial wrong pin offset On windows when you have two monitors and they aren't lined up at the top perfectly, then when you pin a selection the pin window ends up jumping a little bit. Specifically it seems to be half of the screen's y-offset from the global 0? Will this fix it? Not sure. It seems some global measurement needs to be mapped to local? Maybe? --- src/tools/pin/pinwidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/pin/pinwidget.cpp b/src/tools/pin/pinwidget.cpp index f642d0cc31..4cb2040c4f 100644 --- a/src/tools/pin/pinwidget.cpp +++ b/src/tools/pin/pinwidget.cpp @@ -59,12 +59,12 @@ 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); @@ -73,7 +73,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 + @@ -86,7 +86,7 @@ PinWidget::PinWidget(const QPixmap& pixmap, resize(0, 0); move(adjusted_pos.x(), adjusted_pos.y()); } -#endif +//#endif grabGesture(Qt::PinchGesture); this->setContextMenuPolicy(Qt::CustomContextMenu);