Skip to content

Commit

Permalink
Fix pin tool wrong offset on Linux (#3369)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan-Liang authored Oct 9, 2023
1 parent ad39060 commit 06cfa58
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tools/pin/pinwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 +
Expand Down

0 comments on commit 06cfa58

Please sign in to comment.