wayland: Set cursor surface outputs.
This commit is contained in:
parent
7e96f09670
commit
14b70e5e77
3 changed files with 28 additions and 11 deletions
|
@ -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;
|
||||
|
|
|
@ -73,6 +73,7 @@ public:
|
|||
void removeWindowSelectionCursor();
|
||||
|
||||
void updatePointerConstraints();
|
||||
void updateCursorOutputs();
|
||||
|
||||
void setEnableConstraints(bool set);
|
||||
|
||||
|
|
|
@ -162,17 +162,7 @@ bool WaylandClient::belongsToDesktop() const
|
|||
|
||||
void WaylandClient::updateClientOutputs()
|
||||
{
|
||||
QVector<OutputInterface *> 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()
|
||||
|
|
Loading…
Reference in a new issue