Skip to content

Commit 9dfdab8

Browse files
authored
Fix pin position on Windows for scaled screen (flameshot-org#4614)
1 parent d6a70c8 commit 9dfdab8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/tools/pin/pinwidget.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,16 @@ PinWidget::PinWidget(const QPixmap& pixmap,
6060
new QShortcut(Qt::Key_Escape, this, SLOT(close()));
6161

6262
qreal devicePixelRatio = 1;
63-
#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX)
6463
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
6564
if (currentScreen != nullptr) {
6665
devicePixelRatio = currentScreen->devicePixelRatio();
6766
}
68-
#endif
67+
6968
const int margin =
7069
static_cast<int>(static_cast<double>(MARGIN) * devicePixelRatio);
7170
QRect adjusted_pos = geometry + QMargins(margin, margin, margin, margin);
7271
setGeometry(adjusted_pos);
73-
#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX)
72+
7473
if (currentScreen != nullptr) {
7574
QPoint topLeft = currentScreen->geometry().topLeft();
7675
adjusted_pos.setX((adjusted_pos.x() - topLeft.x()) / devicePixelRatio +
@@ -83,7 +82,7 @@ PinWidget::PinWidget(const QPixmap& pixmap,
8382
resize(0, 0);
8483
move(adjusted_pos.x(), adjusted_pos.y());
8584
}
86-
#endif
85+
8786
grabGesture(Qt::PinchGesture);
8887

8988
this->setContextMenuPolicy(Qt::CustomContextMenu);

0 commit comments

Comments
 (0)