Fix pin tool wrong offset on Linux (#3369)

This commit is contained in:
Alan L
2023-10-10 04:07:03 +08:00
committed by GitHub
parent ad39060323
commit 06cfa58342

View File

@@ -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 +