https://bugs.kde.org/show_bug.cgi?id=443357
--- Comment #6 from Adam Williamson <ad...@happyassassin.net> --- Oh, hmm, think I may have managed it myself after all. Does anyone see anything wrong with this? diff --git a/src/plugins/platforms/drm/drm_output.cpp b/src/plugins/platforms/drm/drm_output.cpp index 917bb857d..7ee387219 100644 --- a/src/plugins/platforms/drm/drm_output.cpp +++ b/src/plugins/platforms/drm/drm_output.cpp @@ -102,10 +102,15 @@ bool DrmOutput::hideCursor() return drmModeSetCursor(m_gpu->fd(), m_crtc->id(), 0, 0, 0) == 0; } -bool DrmOutput::showCursor(DrmDumbBuffer *c) +bool DrmOutput::showCursor(DrmDumbBuffer *c, const QPoint &hotspot) { const QSize &s = c->size(); - if (drmModeSetCursor(m_gpu->fd(), m_crtc->id(), c->handle(), s.width(), s.height()) == 0) { + int ret = drmModeSetCursor2(m_gpu->fd(), m_crtc->id(), c->handle(), s.width(), s.height(), hotspot.x(), hotspot.y()); + if (ret == ENOTSUP) { + // for NVIDIA case that does not support drmModeSetCursor2 + ret = drmModeSetCursor(m_gpu->fd(), m_crtc->id(), c->handle(), s.width(), s.height()); + } + if (ret == 0) { if (RenderLoopPrivate::get(m_renderLoop)->presentMode == RenderLoopPrivate::SyncMode::Adaptive && isCursorVisible()) { m_renderLoop->scheduleRepaint(); @@ -122,7 +127,8 @@ bool DrmOutput::showCursor() return false; } - const bool ret = showCursor(m_cursor[m_cursorIndex].data()); + const Cursor * const cursor = Cursors::self()->currentCursor(); + const bool ret = showCursor(m_cursor[m_cursorIndex].data(), logicalToNativeMatrix(cursor->rect(), scale(), transform()).map(cursor->hotspot())); if (!ret) { qCDebug(KWIN_DRM) << "DrmOutput::showCursor(DrmDumbBuffer) failed"; return ret; diff --git a/src/plugins/platforms/drm/drm_output.h b/src/plugins/platforms/drm/drm_output.h index 1f89f9064..af46c88a0 100644 --- a/src/plugins/platforms/drm/drm_output.h +++ b/src/plugins/platforms/drm/drm_output.h @@ -45,7 +45,7 @@ public: ///queues deleting the output after a page flip has completed. void teardown(); void releaseGbm(); - bool showCursor(DrmDumbBuffer *buffer); + bool showCursor(DrmDumbBuffer *buffer, const QPoint &hotspot); bool showCursor(); bool hideCursor(); bool updateCursor(); -- 2.32.0 -- You are receiving this mail because: You are watching all bug changes.