Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/x11_client_test.cpp
Show All 26 Lines | |||||
27 | #include "deleted.h" | 27 | #include "deleted.h" | ||
28 | #include "platform.h" | 28 | #include "platform.h" | ||
29 | #include "screens.h" | 29 | #include "screens.h" | ||
30 | #include "shell_client.h" | 30 | #include "shell_client.h" | ||
31 | #include "wayland_server.h" | 31 | #include "wayland_server.h" | ||
32 | #include "workspace.h" | 32 | #include "workspace.h" | ||
33 | 33 | | |||
34 | #include <KWayland/Client/surface.h> | 34 | #include <KWayland/Client/surface.h> | ||
35 | #include <KWayland/Client/shell.h> | | |||
36 | 35 | | |||
37 | #include <netwm.h> | 36 | #include <netwm.h> | ||
38 | #include <xcb/xcb_icccm.h> | 37 | #include <xcb/xcb_icccm.h> | ||
39 | 38 | | |||
40 | using namespace KWin; | 39 | using namespace KWin; | ||
41 | using namespace KWayland::Client; | 40 | using namespace KWayland::Client; | ||
42 | static const QString s_socketName = QStringLiteral("wayland_test_x11_client-0"); | 41 | static const QString s_socketName = QStringLiteral("wayland_test_x11_client-0"); | ||
43 | 42 | | |||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Line(s) | 159 | { | |||
194 | 193 | | |||
195 | workspace()->slotWindowFullScreen(); | 194 | workspace()->slotWindowFullScreen(); | ||
196 | QVERIFY(client->isFullScreen()); | 195 | QVERIFY(client->isFullScreen()); | ||
197 | QCOMPARE(client->layer(), ActiveLayer); | 196 | QCOMPARE(client->layer(), ActiveLayer); | ||
198 | QCOMPARE(workspace()->stackingOrder().last(), client); | 197 | QCOMPARE(workspace()->stackingOrder().last(), client); | ||
199 | 198 | | |||
200 | // now let's open a Wayland window | 199 | // now let's open a Wayland window | ||
201 | QScopedPointer<Surface> surface(Test::createSurface()); | 200 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
202 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 201 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
203 | auto waylandClient = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 202 | auto waylandClient = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
204 | QVERIFY(waylandClient); | 203 | QVERIFY(waylandClient); | ||
205 | QVERIFY(waylandClient->isActive()); | 204 | QVERIFY(waylandClient->isActive()); | ||
206 | QCOMPARE(waylandClient->layer(), NormalLayer); | 205 | QCOMPARE(waylandClient->layer(), NormalLayer); | ||
207 | QCOMPARE(workspace()->stackingOrder().last(), waylandClient); | 206 | QCOMPARE(workspace()->stackingOrder().last(), waylandClient); | ||
208 | QCOMPARE(workspace()->xStackingOrder().last(), waylandClient); | 207 | QCOMPARE(workspace()->xStackingOrder().last(), waylandClient); | ||
209 | QCOMPARE(client->layer(), NormalLayer); | 208 | QCOMPARE(client->layer(), NormalLayer); | ||
210 | 209 | | |||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Line(s) | 279 | { | |||
305 | QVERIFY(windowCreatedSpy.wait()); | 304 | QVERIFY(windowCreatedSpy.wait()); | ||
306 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | 305 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | ||
307 | QVERIFY(client); | 306 | QVERIFY(client); | ||
308 | QCOMPARE(client->window(), w); | 307 | QCOMPARE(client->window(), w); | ||
309 | QVERIFY(client->isActive()); | 308 | QVERIFY(client->isActive()); | ||
310 | 309 | | |||
311 | // create Wayland window | 310 | // create Wayland window | ||
312 | QScopedPointer<Surface> surface(Test::createSurface()); | 311 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
313 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 312 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
314 | auto waylandClient = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 313 | auto waylandClient = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
315 | QVERIFY(waylandClient); | 314 | QVERIFY(waylandClient); | ||
316 | QVERIFY(waylandClient->isActive()); | 315 | QVERIFY(waylandClient->isActive()); | ||
317 | // activate no window | 316 | // activate no window | ||
318 | workspace()->setActiveClient(nullptr); | 317 | workspace()->setActiveClient(nullptr); | ||
319 | QVERIFY(!waylandClient->isActive()); | 318 | QVERIFY(!waylandClient->isActive()); | ||
320 | QVERIFY(!workspace()->activeClient()); | 319 | QVERIFY(!workspace()->activeClient()); | ||
321 | // and close Wayland window again | 320 | // and close Wayland window again | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 338 | { | |||
373 | connect(client, &Client::windowClosed, this, [&deletedUuid] (Toplevel *, Deleted *d) { deletedUuid = d->internalId(); }); | 372 | connect(client, &Client::windowClosed, this, [&deletedUuid] (Toplevel *, Deleted *d) { deletedUuid = d->internalId(); }); | ||
374 | 373 | | |||
375 | 374 | | |||
376 | NETRootInfo rootInfo(c.data(), NET::WMAllProperties); | 375 | NETRootInfo rootInfo(c.data(), NET::WMAllProperties); | ||
377 | QCOMPARE(rootInfo.activeWindow(), client->window()); | 376 | QCOMPARE(rootInfo.activeWindow(), client->window()); | ||
378 | 377 | | |||
379 | // activate a wayland window | 378 | // activate a wayland window | ||
380 | QScopedPointer<Surface> surface(Test::createSurface()); | 379 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
381 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 380 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
382 | auto waylandClient = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 381 | auto waylandClient = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
383 | QVERIFY(waylandClient); | 382 | QVERIFY(waylandClient); | ||
384 | QVERIFY(waylandClient->isActive()); | 383 | QVERIFY(waylandClient->isActive()); | ||
385 | xcb_flush(kwinApp()->x11Connection()); | 384 | xcb_flush(kwinApp()->x11Connection()); | ||
386 | 385 | | |||
387 | NETRootInfo rootInfo2(c.data(), NET::WMAllProperties); | 386 | NETRootInfo rootInfo2(c.data(), NET::WMAllProperties); | ||
388 | QCOMPARE(rootInfo2.activeWindow(), 0u); | 387 | QCOMPARE(rootInfo2.activeWindow(), 0u); | ||
389 | 388 | | |||
▲ Show 20 Lines • Show All 242 Lines • Show Last 20 Lines |