diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-08-22 16:47:52 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-08-31 07:23:19 +0000 |
commit | 54285dd5f6a660ce0ddd45b222d6c4dcd8ea6f74 (patch) | |
tree | 8d6bf1e8cee5944373d0115f9d09f5f5ee085881 /src/imports | |
parent | bc7e69b176816536bbd0a0ca3c4fd83b1ba160cd (diff) |
Compositor: Fix incorrect hotspot when output.scaleFactor != dpr
This makes WaylandCursorItem automatically move the cursor hotspot when the
scale factor or dpr changes
Task-number: QTBUG-70134
Change-Id: I146ad81e92fe708a6141271ea173bf053b5e05c8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/compositor/WaylandCursorItem.qml | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/imports/compositor/WaylandCursorItem.qml b/src/imports/compositor/WaylandCursorItem.qml index c835ef8b0..331784109 100644 --- a/src/imports/compositor/WaylandCursorItem.qml +++ b/src/imports/compositor/WaylandCursorItem.qml @@ -39,17 +39,24 @@ import QtQuick 2.0 import QtWayland.Compositor 1.0 +import QtQuick.Window 2.11 WaylandQuickItem { id: cursorItem property QtObject seat property int hotspotX: 0 property int hotspotY: 0 + // If we've set an output scale factor different from the device pixel ratio + // then the item will be rendered scaled, so we need to shift the hotspot accordingly + property real scaleCorrection: output ? output.scaleFactor / Screen.devicePixelRatio : 1 visible: cursorItem.surface != null inputEventsEnabled: false enabled: false - transform: Translate { x: -hotspotX; y: -hotspotY } + transform: Translate { + x: -hotspotX * scaleCorrection + y: -hotspotY * scaleCorrection + } Connections { target: seat |