Adjust kwin to pointer constraints changes in kws

This commit is contained in:
Vlad Zahorodnii 2020-11-03 21:54:49 +02:00
parent a62a821389
commit 5926261505
2 changed files with 10 additions and 10 deletions

View file

@ -25,7 +25,7 @@
#include <KWaylandServer/buffer_interface.h>
#include <KWaylandServer/datadevice_interface.h>
#include <KWaylandServer/display.h>
#include <KWaylandServer/pointerconstraints_interface.h>
#include <KWaylandServer/pointerconstraints_v1_interface.h>
#include <KWaylandServer/seat_interface.h>
#include <KWaylandServer/surface_interface.h>
// screenlocker
@ -659,11 +659,11 @@ void PointerInputRedirection::updatePointerConstraints()
}
return;
}
const QRegion r = getConstraintRegion(focus(), cf.data());
const QRegion r = getConstraintRegion(focus(), cf);
if (canConstrain && r.contains(m_pos.toPoint())) {
cf->setConfined(true);
m_confined = true;
m_confinedPointerRegionConnection = connect(cf.data(), &KWaylandServer::ConfinedPointerInterface::regionChanged, this,
m_confinedPointerRegionConnection = connect(cf, &KWaylandServer::ConfinedPointerV1Interface::regionChanged, this,
[this] {
if (!focus()) {
return;
@ -673,7 +673,7 @@ void PointerInputRedirection::updatePointerConstraints()
return;
}
const auto cf = s->confinedPointer();
if (!getConstraintRegion(focus(), cf.data()).contains(m_pos.toPoint())) {
if (!getConstraintRegion(focus(), cf).contains(m_pos.toPoint())) {
// pointer no longer in confined region, break the confinement
cf->setConfined(false);
m_confined = false;
@ -705,14 +705,14 @@ void PointerInputRedirection::updatePointerConstraints()
}
return;
}
const QRegion r = getConstraintRegion(focus(), lock.data());
const QRegion r = getConstraintRegion(focus(), lock);
if (canConstrain && r.contains(m_pos.toPoint())) {
lock->setLocked(true);
m_locked = true;
// The client might cancel pointer locking from its side by unbinding the LockedPointerInterface.
// In this case the cached cursor position hint must be fetched before the resource goes away
m_lockedPointerAboutToBeUnboundConnection = connect(lock.data(), &KWaylandServer::LockedPointerInterface::aboutToBeUnbound, this,
m_lockedPointerAboutToBeUnboundConnection = connect(lock, &KWaylandServer::LockedPointerV1Interface::aboutToBeDestroyed, this,
[this, lock]() {
const auto hint = lock->cursorPositionHint();
if (hint.x() < 0 || hint.y() < 0 || !focus()) {
@ -721,7 +721,7 @@ void PointerInputRedirection::updatePointerConstraints()
auto globalHint = focus()->pos() - focus()->clientContentPos() + hint;
// When the resource finally goes away, reposition the cursor according to the hint
connect(lock.data(), &KWaylandServer::LockedPointerInterface::unbound, this,
connect(lock, &KWaylandServer::LockedPointerV1Interface::destroyed, this,
[this, globalHint]() {
processMotion(globalHint, waylandServer()->seat()->timestamp());
});
@ -781,7 +781,7 @@ QPointF PointerInputRedirection::applyPointerConfinement(const QPointF &pos) con
return pos;
}
const QRegion confinementRegion = getConstraintRegion(focus(), cf.data());
const QRegion confinementRegion = getConstraintRegion(focus(), cf);
if (confinementRegion.contains(pos.toPoint())) {
return pos;
}

View file

@ -42,7 +42,7 @@
#include <KWaylandServer/plasmashell_interface.h>
#include <KWaylandServer/plasmavirtualdesktop_interface.h>
#include <KWaylandServer/plasmawindowmanagement_interface.h>
#include <KWaylandServer/pointerconstraints_interface.h>
#include <KWaylandServer/pointerconstraints_v1_interface.h>
#include <KWaylandServer/pointergestures_v1_interface.h>
#include <KWaylandServer/seat_interface.h>
#include <KWaylandServer/server_decoration_interface.h>
@ -386,7 +386,7 @@ bool WaylandServer::init(const QByteArray &socketName, InitializationFlags flags
m_seat = m_display->createSeat(m_display);
m_seat->create();
m_display->createPointerGesturesV1(m_display);
m_display->createPointerConstraints(PointerConstraintsInterfaceVersion::UnstableV1, m_display)->create();
m_display->createPointerConstraintsV1(m_display);
m_dataDeviceManager = m_display->createDataDeviceManager(m_display);
m_display->createDataControlDeviceManagerV1(m_display);
m_display->createPrimarySelectionDeviceManagerV1(m_display);