Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/pointer_constraints_test.cpp
Show All 29 Lines | |||||
30 | #include <KWayland/Client/compositor.h> | 30 | #include <KWayland/Client/compositor.h> | ||
31 | #include <KWayland/Client/keyboard.h> | 31 | #include <KWayland/Client/keyboard.h> | ||
32 | #include <KWayland/Client/pointer.h> | 32 | #include <KWayland/Client/pointer.h> | ||
33 | #include <KWayland/Client/pointerconstraints.h> | 33 | #include <KWayland/Client/pointerconstraints.h> | ||
34 | #include <KWayland/Client/region.h> | 34 | #include <KWayland/Client/region.h> | ||
35 | #include <KWayland/Client/seat.h> | 35 | #include <KWayland/Client/seat.h> | ||
36 | #include <KWayland/Client/shm_pool.h> | 36 | #include <KWayland/Client/shm_pool.h> | ||
37 | #include <KWayland/Client/surface.h> | 37 | #include <KWayland/Client/surface.h> | ||
38 | #include <KWayland/Server/seat_interface.h> | 38 | #include <KWaylandServer/seat_interface.h> | ||
39 | #include <KWayland/Server/surface_interface.h> | 39 | #include <KWaylandServer/surface_interface.h> | ||
40 | 40 | | |||
41 | #include <linux/input.h> | 41 | #include <linux/input.h> | ||
42 | 42 | | |||
43 | #include <functional> | 43 | #include <functional> | ||
44 | 44 | | |||
45 | using namespace KWin; | 45 | using namespace KWin; | ||
46 | using namespace KWayland::Client; | 46 | using namespace KWayland::Client; | ||
47 | 47 | | |||
▲ Show 20 Lines • Show All 209 Lines • ▼ Show 20 Line(s) | 128 | { | |||
257 | surface->commit(Surface::CommitFlag::None); | 257 | surface->commit(Surface::CommitFlag::None); | ||
258 | QVERIFY(confinedSpy2.wait()); | 258 | QVERIFY(confinedSpy2.wait()); | ||
259 | QCOMPARE(input()->pointer()->isConstrained(), true); | 259 | QCOMPARE(input()->pointer()->isConstrained(), true); | ||
260 | 260 | | |||
261 | // delete pointer confine | 261 | // delete pointer confine | ||
262 | confinedPointer.reset(nullptr); | 262 | confinedPointer.reset(nullptr); | ||
263 | Test::flushWaylandConnection(); | 263 | Test::flushWaylandConnection(); | ||
264 | 264 | | |||
265 | QSignalSpy constraintsChangedSpy(input()->pointer()->focus()->surface(), &KWayland::Server::SurfaceInterface::pointerConstraintsChanged); | 265 | QSignalSpy constraintsChangedSpy(input()->pointer()->focus()->surface(), &KWaylandServer::SurfaceInterface::pointerConstraintsChanged); | ||
266 | QVERIFY(constraintsChangedSpy.isValid()); | 266 | QVERIFY(constraintsChangedSpy.isValid()); | ||
267 | QVERIFY(constraintsChangedSpy.wait()); | 267 | QVERIFY(constraintsChangedSpy.wait()); | ||
268 | 268 | | |||
269 | // should be unconfined | 269 | // should be unconfined | ||
270 | QCOMPARE(input()->pointer()->isConstrained(), false); | 270 | QCOMPARE(input()->pointer()->isConstrained(), false); | ||
271 | 271 | | |||
272 | // confine again | 272 | // confine again | ||
273 | confinedPointer.reset(Test::waylandPointerConstraints()->confinePointer(surface.data(), pointer.data(), nullptr, PointerConstraints::LifeTime::Persistent)); | 273 | confinedPointer.reset(Test::waylandPointerConstraints()->confinePointer(surface.data(), pointer.data(), nullptr, PointerConstraints::LifeTime::Persistent)); | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 294 | { | |||
344 | QCOMPARE(input()->pointer()->isConstrained(), true); | 344 | QCOMPARE(input()->pointer()->isConstrained(), true); | ||
345 | KWin::Cursors::self()->mouse()->setPos(c->frameGeometry().center()); | 345 | KWin::Cursors::self()->mouse()->setPos(c->frameGeometry().center()); | ||
346 | QCOMPARE(KWin::Cursors::self()->mouse()->pos(), c->frameGeometry().center() + QPoint(1, 1)); | 346 | QCOMPARE(KWin::Cursors::self()->mouse()->pos(), c->frameGeometry().center() + QPoint(1, 1)); | ||
347 | 347 | | |||
348 | // delete pointer lock | 348 | // delete pointer lock | ||
349 | lockedPointer.reset(nullptr); | 349 | lockedPointer.reset(nullptr); | ||
350 | Test::flushWaylandConnection(); | 350 | Test::flushWaylandConnection(); | ||
351 | 351 | | |||
352 | QSignalSpy constraintsChangedSpy(input()->pointer()->focus()->surface(), &KWayland::Server::SurfaceInterface::pointerConstraintsChanged); | 352 | QSignalSpy constraintsChangedSpy(input()->pointer()->focus()->surface(), &KWaylandServer::SurfaceInterface::pointerConstraintsChanged); | ||
353 | QVERIFY(constraintsChangedSpy.isValid()); | 353 | QVERIFY(constraintsChangedSpy.isValid()); | ||
354 | QVERIFY(constraintsChangedSpy.wait()); | 354 | QVERIFY(constraintsChangedSpy.wait()); | ||
355 | 355 | | |||
356 | // moving cursor should be allowed again | 356 | // moving cursor should be allowed again | ||
357 | QCOMPARE(input()->pointer()->isConstrained(), false); | 357 | QCOMPARE(input()->pointer()->isConstrained(), false); | ||
358 | KWin::Cursors::self()->mouse()->setPos(c->frameGeometry().center()); | 358 | KWin::Cursors::self()->mouse()->setPos(c->frameGeometry().center()); | ||
359 | QCOMPARE(KWin::Cursors::self()->mouse()->pos(), c->frameGeometry().center()); | 359 | QCOMPARE(KWin::Cursors::self()->mouse()->pos(), c->frameGeometry().center()); | ||
360 | } | 360 | } | ||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |