From 589eb085aecb5d25410bf5ef28eb8ec4fd0d4428 Mon Sep 17 00:00:00 2001 From: John Yani <361985+Vanuan@users.noreply.github.com> Date: Wed, 30 Sep 2020 20:37:08 +0300 Subject: [PATCH] HiDPI: Hot point scaling is only required for X11 --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 867b75d389..e58181641b 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -847,10 +847,17 @@ public: cursorPainter.begin(&cursorPixmap); cursorPainter.drawPixmap(16 * pixelRatio, 16 * pixelRatio, icon); cursorPainter.end(); + int hotX = 8; + int hotY = 8; #if QT_VERSION >= 0x050000 cursorPixmap.setDevicePixelRatio(pixelRatio); + // only X11 needs hot point coordinates to be scaled + if (qGuiApp->platformName == "xcb")) { + hotX *= pixelRatio; + hotY *= pixelRatio; + } #endif - setCursor(cursorPixmap, 7 * pixelRatio, 7 * pixelRatio, false); + setCursor(cursorPixmap, hotX, hotY, false); } virtual void mouseMove(Base::Vector2d /*onSketchPos*/) {} @@ -1853,7 +1860,9 @@ public: GenericConstraintSelection* selFilterGate = new GenericConstraintSelection(sketchgui->getObject()); selFilterGate->setAllowedSelTypes(SelVertex|SelRoot); Gui::Selection().addSelectionGate(selFilterGate); - setCursor(QPixmap(cursor_createcoincident), 7, 7); + int hotX = 8; + int hotY = 8; + setCursor(QPixmap(cursor_createcoincident), hotX, hotY); } virtual void mouseMove(Base::Vector2d onSketchPos) {Q_UNUSED(onSketchPos);}