From b484490245e2ae559f461390e38359572b4bcc5e Mon Sep 17 00:00:00 2001 From: Marc Deop Date: Feb 28 2022 13:25:06 +0000 Subject: Revert "Fix cursor offset on wayland in virtual machines (#2011066)" This reverts commit 6804a051f1415090fbaa0583a1b1d103b789e290. --- diff --git a/0001-Fix-wrong-cursor-hotspot-under-Wayland-on-VMs.patch b/0001-Fix-wrong-cursor-hotspot-under-Wayland-on-VMs.patch deleted file mode 100644 index 08e4c24..0000000 --- a/0001-Fix-wrong-cursor-hotspot-under-Wayland-on-VMs.patch +++ /dev/null @@ -1,65 +0,0 @@ -From e413264fab376f043d4dce73fc528cac6c3466a0 Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Wed, 6 Oct 2021 10:20:58 -0700 -Subject: [PATCH] Fix wrong cursor hotspot under Wayland on VMs - -This backports the key parts of 998bbf4 to the 5.22 branch, -where the code is substantially different. It solves a problem -where the click point is slightly offset from the position -indicated by the displayed cursor when running on Wayland in -many VM configurations (e.g. qemu with qxl or virtio GPU). - -Signed-off-by: Adam Williamson ---- - src/plugins/platforms/drm/drm_output.cpp | 12 +++++++++--- - src/plugins/platforms/drm/drm_output.h | 2 +- - 2 files changed, 10 insertions(+), 4 deletions(-) - -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 - diff --git a/kwin.spec b/kwin.spec index 6f87ac7..9546a31 100644 --- a/kwin.spec +++ b/kwin.spec @@ -17,7 +17,7 @@ Name: kwin Version: 5.22.5 -Release: 2%{?dist} +Release: 1%{?dist} Summary: KDE Window manager # all sources are effectively GPLv2+, except for: @@ -37,10 +37,6 @@ URL: https://userbase.kde.org/KWin Source0: http://download.kde.org/%{stable}/plasma/%{version}/%{name}-%{version}.tar.xz ## upstream patches -# Fix cursor offset in Wayland VMs; effectively a backport of -# https://github.com/KDE/kwin/commit/998bbf4e -# https://bugzilla.redhat.com/show_bug.cgi?id=2011066 -Patch0: 0001-Fix-wrong-cursor-hotspot-under-Wayland-on-VMs.patch ## proposed patches @@ -365,9 +361,6 @@ make test ARGS="--output-on-failure --timeout 10" -C %{_target_platform} ||: %changelog -* Tue Oct 05 2021 Adam Williamson - 5.22.5-2 -- Fix cursor offset on wayland in virtual machines (#2011066) - * Tue Aug 31 2021 Jan Grulich - 5.22.5-1 - 5.22.5