From 39d269008f21c0bfa0a710b8fa36b91520063ff9 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 5 May 2023 22:20:00 +0300 Subject: [PATCH] Avoid rounding coordinates of motion events more --- src/input.cpp | 12 ++++++------ src/xwayland/databridge.cpp | 4 ++-- src/xwayland/databridge.h | 2 +- src/xwayland/dnd.cpp | 4 ++-- src/xwayland/dnd.h | 2 +- src/xwayland/drag.h | 2 +- src/xwayland/drag_wl.cpp | 2 +- src/xwayland/drag_wl.h | 2 +- src/xwayland/drag_x.cpp | 2 +- src/xwayland/drag_x.h | 2 +- src/xwayland/xwayland.cpp | 4 ++-- src/xwayland/xwayland.h | 2 +- src/xwayland/xwayland_interface.h | 3 +-- 13 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index fba730b47e..ce337d05d8 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -316,7 +316,7 @@ public: return false; } - auto window = input()->findToplevel(event->globalPos()); + auto window = input()->findToplevel(event->globalPosition()); if (window && window->isClient() && window->isLockScreen()) { workspace()->activateWindow(window); } @@ -728,7 +728,7 @@ public: if (event->button() == Qt::RightButton) { cancel(); } else { - accept(event->globalPos()); + accept(event->globalPosition()); } } break; @@ -1161,7 +1161,7 @@ std::pair performWindowMouseAction(QMouseEvent *event, Window *windo } } if (wasAction) { - return std::make_pair(wasAction, !window->performMouseCommand(command, event->globalPos())); + return std::make_pair(wasAction, !window->performMouseCommand(command, event->globalPosition())); } return std::make_pair(wasAction, false); } @@ -1198,7 +1198,7 @@ class InternalWindowEventFilter : public InputEventFilter QWindow *internal = static_cast(input()->pointer()->focus())->handle(); QMouseEvent mouseEvent(event->type(), event->pos() - internal->position(), - event->globalPos(), + event->globalPosition(), event->button(), event->buttons(), event->modifiers()); QCoreApplication::sendEvent(internal, &mouseEvent); return mouseEvent.isAccepted(); @@ -1782,7 +1782,7 @@ public: seat->setTimestamp(event->timestamp()); switch (event->type()) { case QEvent::MouseMove: { - seat->notifyPointerMotion(event->globalPos()); + seat->notifyPointerMotion(event->globalPosition()); MouseEvent *e = static_cast(event); if (!e->delta().isNull()) { seat->relativePointerMotion(e->delta(), e->deltaUnaccelerated(), e->timestamp()); @@ -2430,7 +2430,7 @@ public: m_dragTarget = dragTarget; if (auto *xwl = kwinApp()->xwayland()) { - const auto ret = xwl->dragMoveFilter(dragTarget, event->globalPos()); + const auto ret = xwl->dragMoveFilter(dragTarget); if (ret == Xwl::DragEventReply::Ignore) { return false; } else if (ret == Xwl::DragEventReply::Take) { diff --git a/src/xwayland/databridge.cpp b/src/xwayland/databridge.cpp index b0de4aea99..6905237cf7 100644 --- a/src/xwayland/databridge.cpp +++ b/src/xwayland/databridge.cpp @@ -51,9 +51,9 @@ bool DataBridge::nativeEventFilter(const QByteArray &eventType, void *message, q return false; } -DragEventReply DataBridge::dragMoveFilter(Window *target, const QPoint &pos) +DragEventReply DataBridge::dragMoveFilter(Window *target) { - return m_dnd->dragMoveFilter(target, pos); + return m_dnd->dragMoveFilter(target); } } // namespace Xwl diff --git a/src/xwayland/databridge.h b/src/xwayland/databridge.h index a0c404e89a..31984b28b9 100644 --- a/src/xwayland/databridge.h +++ b/src/xwayland/databridge.h @@ -44,7 +44,7 @@ class DataBridge : public QObject, public QAbstractNativeEventFilter public: explicit DataBridge(); - DragEventReply dragMoveFilter(Window *target, const QPoint &pos); + DragEventReply dragMoveFilter(Window *target); Dnd *dnd() const { diff --git a/src/xwayland/dnd.cpp b/src/xwayland/dnd.cpp index 1afe213c01..6e161966de 100644 --- a/src/xwayland/dnd.cpp +++ b/src/xwayland/dnd.cpp @@ -130,10 +130,10 @@ bool Dnd::handleClientMessage(xcb_client_message_event_t *event) return false; } -DragEventReply Dnd::dragMoveFilter(Window *target, const QPoint &pos) +DragEventReply Dnd::dragMoveFilter(Window *target) { Q_ASSERT(m_currentDrag); - return m_currentDrag->moveFilter(target, pos); + return m_currentDrag->moveFilter(target); } void Dnd::startDrag() diff --git a/src/xwayland/dnd.h b/src/xwayland/dnd.h index d7976a1fd1..d7472ae104 100644 --- a/src/xwayland/dnd.h +++ b/src/xwayland/dnd.h @@ -48,7 +48,7 @@ public: void x11OffersChanged(const QStringList &added, const QStringList &removed) override; bool handleClientMessage(xcb_client_message_event_t *event) override; - DragEventReply dragMoveFilter(Window *target, const QPoint &pos); + DragEventReply dragMoveFilter(Window *target); using DnDAction = KWaylandServer::DataDeviceManagerInterface::DnDAction; using DnDActions = KWaylandServer::DataDeviceManagerInterface::DnDActions; diff --git a/src/xwayland/drag.h b/src/xwayland/drag.h index 475bf98a98..b0db7db478 100644 --- a/src/xwayland/drag.h +++ b/src/xwayland/drag.h @@ -35,7 +35,7 @@ public: static void sendClientMessage(xcb_window_t target, xcb_atom_t type, xcb_client_message_data_t *data); virtual bool handleClientMessage(xcb_client_message_event_t *event) = 0; - virtual DragEventReply moveFilter(Window *target, const QPoint &pos) = 0; + virtual DragEventReply moveFilter(Window *target) = 0; Q_SIGNALS: void finish(Drag *self); diff --git a/src/xwayland/drag_wl.cpp b/src/xwayland/drag_wl.cpp index 8052bfd987..866eb095b4 100644 --- a/src/xwayland/drag_wl.cpp +++ b/src/xwayland/drag_wl.cpp @@ -40,7 +40,7 @@ WlToXDrag::WlToXDrag(Dnd *dnd) { } -DragEventReply WlToXDrag::moveFilter(Window *target, const QPoint &pos) +DragEventReply WlToXDrag::moveFilter(Window *target) { return DragEventReply::Wayland; } diff --git a/src/xwayland/drag_wl.h b/src/xwayland/drag_wl.h index 2c7a3c4df9..bf39698620 100644 --- a/src/xwayland/drag_wl.h +++ b/src/xwayland/drag_wl.h @@ -42,7 +42,7 @@ class WlToXDrag : public Drag public: explicit WlToXDrag(Dnd *dnd); - DragEventReply moveFilter(Window *target, const QPoint &pos) override; + DragEventReply moveFilter(Window *target) override; bool handleClientMessage(xcb_client_message_event_t *event) override; private: diff --git a/src/xwayland/drag_x.cpp b/src/xwayland/drag_x.cpp index c232958daa..5a55986419 100644 --- a/src/xwayland/drag_x.cpp +++ b/src/xwayland/drag_x.cpp @@ -118,7 +118,7 @@ XToWlDrag::~XToWlDrag() { } -DragEventReply XToWlDrag::moveFilter(Window *target, const QPoint &pos) +DragEventReply XToWlDrag::moveFilter(Window *target) { auto *seat = waylandServer()->seat(); diff --git a/src/xwayland/drag_x.h b/src/xwayland/drag_x.h index 7d340e16cd..cd39fb69aa 100644 --- a/src/xwayland/drag_x.h +++ b/src/xwayland/drag_x.h @@ -38,7 +38,7 @@ public: explicit XToWlDrag(X11Source *source, Dnd *dnd); ~XToWlDrag() override; - DragEventReply moveFilter(Window *target, const QPoint &pos) override; + DragEventReply moveFilter(Window *target) override; bool handleClientMessage(xcb_client_message_event_t *event) override; void setDragAndDropAction(KWaylandServer::DataDeviceManagerInterface::DnDAction action); diff --git a/src/xwayland/xwayland.cpp b/src/xwayland/xwayland.cpp index cfe79fe4a7..d8c1ef04b5 100644 --- a/src/xwayland/xwayland.cpp +++ b/src/xwayland/xwayland.cpp @@ -452,10 +452,10 @@ void Xwayland::destroyX11Connection() Q_EMIT m_app->x11ConnectionChanged(); } -DragEventReply Xwayland::dragMoveFilter(Window *target, const QPoint &pos) +DragEventReply Xwayland::dragMoveFilter(Window *target) { if (m_dataBridge) { - return m_dataBridge->dragMoveFilter(target, pos); + return m_dataBridge->dragMoveFilter(target); } else { return DragEventReply::Wayland; } diff --git a/src/xwayland/xwayland.h b/src/xwayland/xwayland.h index 8f8f1d44c1..b5d92d36f3 100644 --- a/src/xwayland/xwayland.h +++ b/src/xwayland/xwayland.h @@ -79,7 +79,7 @@ private: bool createX11Connection(); void destroyX11Connection(); - DragEventReply dragMoveFilter(Window *target, const QPoint &pos) override; + DragEventReply dragMoveFilter(Window *target) override; KWaylandServer::AbstractDropHandler *xwlDropHandler() override; QSocketNotifier *m_socketNotifier = nullptr; diff --git a/src/xwayland/xwayland_interface.h b/src/xwayland/xwayland_interface.h index a5711a5f56..655af2e3b8 100644 --- a/src/xwayland/xwayland_interface.h +++ b/src/xwayland/xwayland_interface.h @@ -11,7 +11,6 @@ #include "libkwineffects/kwinglobals.h" #include -#include class QProcess; @@ -39,7 +38,7 @@ enum class DragEventReply { class KWIN_EXPORT XwaylandInterface { public: - virtual Xwl::DragEventReply dragMoveFilter(Window *target, const QPoint &pos) = 0; + virtual Xwl::DragEventReply dragMoveFilter(Window *target) = 0; virtual KWaylandServer::AbstractDropHandler *xwlDropHandler() = 0; protected: