Avoid rounding coordinates of motion events more

This commit is contained in:
Vlad Zahorodnii 2023-05-05 22:20:00 +03:00
parent fdae03ee62
commit 39d269008f
13 changed files with 21 additions and 22 deletions

View file

@ -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<bool, bool> 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<InternalWindow *>(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<MouseEvent *>(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) {

View file

@ -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

View file

@ -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
{

View file

@ -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()

View file

@ -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;

View file

@ -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);

View file

@ -40,7 +40,7 @@ WlToXDrag::WlToXDrag(Dnd *dnd)
{
}
DragEventReply WlToXDrag::moveFilter(Window *target, const QPoint &pos)
DragEventReply WlToXDrag::moveFilter(Window *target)
{
return DragEventReply::Wayland;
}

View file

@ -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:

View file

@ -118,7 +118,7 @@ XToWlDrag::~XToWlDrag()
{
}
DragEventReply XToWlDrag::moveFilter(Window *target, const QPoint &pos)
DragEventReply XToWlDrag::moveFilter(Window *target)
{
auto *seat = waylandServer()->seat();

View file

@ -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);

View file

@ -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;
}

View file

@ -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;

View file

@ -11,7 +11,6 @@
#include "libkwineffects/kwinglobals.h"
#include <QObject>
#include <QPoint>
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: