core: Drop Platform::warpPointer()

It's odd to manipulate host cursor position and it's not highly
important, for example we haven't had a need to warp the cursor on
wayland.

The main motivation behind this change is to slim down the Platform to
make it more output oriented.
This commit is contained in:
Vlad Zahorodnii 2022-11-02 22:16:21 +02:00
parent f20ed67ba0
commit c76563b174
7 changed files with 1 additions and 30 deletions

View file

@ -77,7 +77,6 @@ DrmBackend::DrmBackend(Session *session, QObject *parent)
, m_explicitGpus(splitPathList(qEnvironmentVariable("KWIN_DRM_DEVICES"), ':')) , m_explicitGpus(splitPathList(qEnvironmentVariable("KWIN_DRM_DEVICES"), ':'))
, m_dpmsFilter() , m_dpmsFilter()
{ {
setSupportsPointerWarping(true);
setSupportsGammaControl(true); setSupportsGammaControl(true);
} }

View file

@ -30,7 +30,6 @@ VirtualBackend::VirtualBackend(QObject *parent)
} }
} }
setSupportsPointerWarping(true);
setSupportsGammaControl(true); setSupportsGammaControl(true);
} }

View file

@ -155,7 +155,6 @@ void X11WindowedInputBackend::initialize()
X11WindowedBackend::X11WindowedBackend() X11WindowedBackend::X11WindowedBackend()
{ {
setSupportsPointerWarping(true);
} }
X11WindowedBackend::~X11WindowedBackend() X11WindowedBackend::~X11WindowedBackend()
@ -656,13 +655,6 @@ std::unique_ptr<InputBackend> X11WindowedBackend::createInputBackend()
return std::make_unique<X11WindowedInputBackend>(this); return std::make_unique<X11WindowedInputBackend>(this);
} }
void X11WindowedBackend::warpPointer(const QPointF &globalPos)
{
const xcb_window_t w = m_outputs.at(0)->window();
xcb_warp_pointer(m_connection, w, w, 0, 0, 0, 0, globalPos.x(), globalPos.y());
xcb_flush(m_connection);
}
xcb_window_t X11WindowedBackend::windowForScreen(Output *output) const xcb_window_t X11WindowedBackend::windowForScreen(Output *output) const
{ {
if (!output) { if (!output) {

View file

@ -117,7 +117,6 @@ public:
std::unique_ptr<OpenGLBackend> createOpenGLBackend() override; std::unique_ptr<OpenGLBackend> createOpenGLBackend() override;
std::unique_ptr<QPainterBackend> createQPainterBackend() override; std::unique_ptr<QPainterBackend> createQPainterBackend() override;
std::unique_ptr<InputBackend> createInputBackend() override; std::unique_ptr<InputBackend> createInputBackend() override;
void warpPointer(const QPointF &globalPos) override;
QVector<CompositingType> supportedCompositors() const override QVector<CompositingType> supportedCompositors() const override
{ {

View file

@ -134,10 +134,6 @@ void Platform::removeVirtualOutput(Output *output)
Q_ASSERT(!output); Q_ASSERT(!output);
} }
void Platform::warpPointer(const QPointF &globalPos)
{
}
bool Platform::supportsNativeFence() const bool Platform::supportsNativeFence() const
{ {
if (Compositor *compositor = Compositor::self()) { if (Compositor *compositor = Compositor::self()) {

View file

@ -74,7 +74,6 @@ public:
* The default implementation creates an InputRedirectionCursor. * The default implementation creates an InputRedirectionCursor.
*/ */
virtual void createPlatformCursor(QObject *parent = nullptr); virtual void createPlatformCursor(QObject *parent = nullptr);
virtual void warpPointer(const QPointF &globalPos);
/** /**
* Whether our Compositing EGL display supports creating native EGL fences. * Whether our Compositing EGL display supports creating native EGL fences.
*/ */
@ -203,10 +202,6 @@ public:
{ {
m_deviceIdentifier = identifier; m_deviceIdentifier = identifier;
} }
bool supportsPointerWarping() const
{
return m_pointerWarping;
}
int initialOutputCount() const int initialOutputCount() const
{ {
return m_initialOutputCount; return m_initialOutputCount;
@ -304,10 +299,6 @@ protected:
{ {
return m_deviceIdentifier; return m_deviceIdentifier;
} }
void setSupportsPointerWarping(bool set)
{
m_pointerWarping = set;
}
void setSupportsGammaControl(bool set) void setSupportsGammaControl(bool set)
{ {
m_supportsGammaControl = set; m_supportsGammaControl = set;
@ -317,7 +308,6 @@ private:
bool m_ready = false; bool m_ready = false;
QSize m_initialWindowSize; QSize m_initialWindowSize;
QByteArray m_deviceIdentifier; QByteArray m_deviceIdentifier;
bool m_pointerWarping = false;
int m_initialOutputCount = 1; int m_initialOutputCount = 1;
qreal m_initialOutputScale = 1; qreal m_initialOutputScale = 1;
EGLDisplay m_eglDisplay; EGLDisplay m_eglDisplay;

View file

@ -815,17 +815,13 @@ void PointerInputRedirection::updateButton(uint32_t button, InputRedirection::Po
void PointerInputRedirection::warp(const QPointF &pos) void PointerInputRedirection::warp(const QPointF &pos)
{ {
if (supportsWarping()) { if (supportsWarping()) {
kwinApp()->platform()->warpPointer(pos);
processMotionAbsolute(pos, waylandServer()->seat()->timestamp()); processMotionAbsolute(pos, waylandServer()->seat()->timestamp());
} }
} }
bool PointerInputRedirection::supportsWarping() const bool PointerInputRedirection::supportsWarping() const
{ {
if (!inited()) { return inited();
return false;
}
return kwinApp()->platform()->supportsPointerWarping();
} }
void PointerInputRedirection::updateAfterScreenChange() void PointerInputRedirection::updateAfterScreenChange()