diff --git a/src/pointer_input.cpp b/src/pointer_input.cpp index cfcd2fe0d1..b0246fb45e 100644 --- a/src/pointer_input.cpp +++ b/src/pointer_input.cpp @@ -118,6 +118,7 @@ void PointerInputRedirection::init() connect(m_cursor, &CursorImage::changed, Cursors::self()->mouse(), [this] { auto cursor = Cursors::self()->mouse(); cursor->updateCursor(m_cursor->image(), m_cursor->hotSpot()); + updateCursorOutputs(); }); Q_EMIT m_cursor->changed(); @@ -825,10 +826,35 @@ void PointerInputRedirection::updatePosition(const QPointF &pos) if (!screenContainsPos(p)) { return; } + m_pos = p; + + updateCursorOutputs(); + Q_EMIT input()->globalPointerChanged(m_pos); } +void PointerInputRedirection::updateCursorOutputs() +{ + KWaylandServer::PointerInterface *pointer = waylandServer()->seat()->pointer(); + if (!pointer) { + return; + } + + KWaylandServer::Cursor *cursor = pointer->cursor(); + if (!cursor) { + return; + } + + KWaylandServer::SurfaceInterface *surface = cursor->surface(); + if (!surface) { + return; + } + + const QRectF cursorGeometry(m_pos - m_cursor->hotSpot(), surface->size()); + surface->setOutputs(waylandServer()->display()->outputsIntersecting(cursorGeometry.toAlignedRect())); +} + void PointerInputRedirection::updateButton(uint32_t button, InputRedirection::PointerButtonState state) { m_buttons[button] = state; diff --git a/src/pointer_input.h b/src/pointer_input.h index fa5bb0f5b8..13949e7731 100644 --- a/src/pointer_input.h +++ b/src/pointer_input.h @@ -73,6 +73,7 @@ public: void removeWindowSelectionCursor(); void updatePointerConstraints(); + void updateCursorOutputs(); void setEnableConstraints(bool set); diff --git a/src/waylandclient.cpp b/src/waylandclient.cpp index 34ac39a39a..17af20be05 100644 --- a/src/waylandclient.cpp +++ b/src/waylandclient.cpp @@ -162,17 +162,7 @@ bool WaylandClient::belongsToDesktop() const void WaylandClient::updateClientOutputs() { - QVector clientOutputs; - const auto outputs = waylandServer()->display()->outputs(); - for (const auto output : outputs) { - if (output->isEnabled()) { - const QRect outputGeometry(output->globalPosition(), output->pixelSize() / output->scale()); - if (frameGeometry().intersects(outputGeometry)) { - clientOutputs << output; - } - } - } - surface()->setOutputs(clientOutputs); + surface()->setOutputs(waylandServer()->display()->outputsIntersecting(frameGeometry())); } void WaylandClient::updateIcon()