From 06cfa58342ac335ec5863bb24efd5ed9a030d72f Mon Sep 17 00:00:00 2001 From: Alan L Date: Tue, 10 Oct 2023 04:07:03 +0800 Subject: [PATCH] Fix pin tool wrong offset on Linux (#3369) --- src/tools/pin/pinwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/pin/pinwidget.cpp b/src/tools/pin/pinwidget.cpp index a315b4c0..8baa19e7 100644 --- a/src/tools/pin/pinwidget.cpp +++ b/src/tools/pin/pinwidget.cpp @@ -58,7 +58,7 @@ PinWidget::PinWidget(const QPixmap& pixmap, new QShortcut(Qt::Key_Escape, this, SLOT(close())); qreal devicePixelRatio = 1; -#if defined(Q_OS_MACOS) +#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX) QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen(); if (currentScreen != nullptr) { devicePixelRatio = currentScreen->devicePixelRatio(); @@ -72,7 +72,7 @@ PinWidget::PinWidget(const QPixmap& pixmap, setWindowFlags(Qt::X11BypassWindowManagerHint); #endif -#if defined(Q_OS_MACOS) +#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 +