diff --git a/plugins/platforms/drm/drm_output.cpp b/plugins/platforms/drm/drm_output.cpp
index 8231baf105..c7f8eb397e 100644
--- a/plugins/platforms/drm/drm_output.cpp
+++ b/plugins/platforms/drm/drm_output.cpp
@@ -43,6 +43,7 @@ along with this program. If not, see .
#include
#include
// Qt
+#include
#include
// drm
#include
@@ -104,7 +105,15 @@ void DrmOutput::showCursor(DrmDumbBuffer *c)
void DrmOutput::moveCursor(const QPoint &globalPos)
{
- const QPoint p = ((globalPos - m_globalPos) * m_scale) - m_backend->softwareCursorHotspot();
+ QMatrix4x4 matrix;
+ if (m_orientation == Qt::InvertedLandscapeOrientation) {
+ matrix.translate(pixelSize().width() /2, pixelSize().height() / 2);
+ matrix.rotate(180.0f, 0.0f, 0.0f, 1.0f);
+ matrix.translate(-pixelSize().width() /2, -pixelSize().height() / 2);
+ }
+ matrix.scale(m_scale);
+ matrix.translate(-m_globalPos.x(), -m_globalPos.y());
+ const QPoint p = matrix.map(globalPos) - m_backend->softwareCursorHotspot();
drmModeMoveCursor(m_backend->fd(), m_crtc->id(), p.x(), p.y());
}