Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/globalshortcuts_test.cpp
Show All 23 Lines | |||||
24 | #include "internal_client.h" | 24 | #include "internal_client.h" | ||
25 | #include "platform.h" | 25 | #include "platform.h" | ||
26 | #include "screens.h" | 26 | #include "screens.h" | ||
27 | #include "shell_client.h" | 27 | #include "shell_client.h" | ||
28 | #include "useractions.h" | 28 | #include "useractions.h" | ||
29 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
30 | #include "workspace.h" | 30 | #include "workspace.h" | ||
31 | 31 | | |||
32 | #include <KWayland/Client/shell.h> | | |||
33 | #include <KWayland/Client/surface.h> | 32 | #include <KWayland/Client/surface.h> | ||
34 | #include <KWayland/Server/seat_interface.h> | 33 | #include <KWayland/Server/seat_interface.h> | ||
35 | 34 | | |||
36 | #include <KGlobalAccel> | 35 | #include <KGlobalAccel> | ||
37 | #include <linux/input.h> | 36 | #include <linux/input.h> | ||
38 | 37 | | |||
39 | #include <netwm.h> | 38 | #include <netwm.h> | ||
40 | #include <xcb/xcb_icccm.h> | 39 | #include <xcb/xcb_icccm.h> | ||
▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Line(s) | 157 | { | |||
161 | // Ctrl+alt+F3 keysym for vt switching. xkbcommon considers all modifiers as consumed | 160 | // Ctrl+alt+F3 keysym for vt switching. xkbcommon considers all modifiers as consumed | ||
162 | // which a transformation to any keysym would cause | 161 | // which a transformation to any keysym would cause | ||
163 | // for more information see: | 162 | // for more information see: | ||
164 | // https://bugs.freedesktop.org/show_bug.cgi?id=92818 | 163 | // https://bugs.freedesktop.org/show_bug.cgi?id=92818 | ||
165 | // https://github.com/xkbcommon/libxkbcommon/issues/17 | 164 | // https://github.com/xkbcommon/libxkbcommon/issues/17 | ||
166 | 165 | | |||
167 | // first create a window | 166 | // first create a window | ||
168 | QScopedPointer<Surface> surface(Test::createSurface()); | 167 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
169 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 168 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
170 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 169 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
171 | QVERIFY(c); | 170 | QVERIFY(c); | ||
172 | QVERIFY(c->isActive()); | 171 | QVERIFY(c->isActive()); | ||
173 | 172 | | |||
174 | quint32 timestamp = 0; | 173 | quint32 timestamp = 0; | ||
175 | QVERIFY(!workspace()->userActionsMenu()->isShown()); | 174 | QVERIFY(!workspace()->userActionsMenu()->isShown()); | ||
176 | kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); | 175 | kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); | ||
177 | kwinApp()->platform()->keyboardKeyPressed(KEY_F3, timestamp++); | 176 | kwinApp()->platform()->keyboardKeyPressed(KEY_F3, timestamp++); | ||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | 236 | { | |||
300 | xcb_destroy_window(c.data(), w); | 299 | xcb_destroy_window(c.data(), w); | ||
301 | xcb_flush(c.data()); | 300 | xcb_flush(c.data()); | ||
302 | QVERIFY(windowClosedSpy.wait()); | 301 | QVERIFY(windowClosedSpy.wait()); | ||
303 | } | 302 | } | ||
304 | 303 | | |||
305 | void GlobalShortcutsTest::testWaylandClientShortcut() | 304 | void GlobalShortcutsTest::testWaylandClientShortcut() | ||
306 | { | 305 | { | ||
307 | QScopedPointer<Surface> surface(Test::createSurface()); | 306 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
308 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 307 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
309 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 308 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
310 | 309 | | |||
311 | QCOMPARE(workspace()->activeClient(), client); | 310 | QCOMPARE(workspace()->activeClient(), client); | ||
312 | QVERIFY(client->isActive()); | 311 | QVERIFY(client->isActive()); | ||
313 | QCOMPARE(client->shortcut(), QKeySequence()); | 312 | QCOMPARE(client->shortcut(), QKeySequence()); | ||
314 | const QKeySequence seq(Qt::META + Qt::SHIFT + Qt::Key_Y); | 313 | const QKeySequence seq(Qt::META + Qt::SHIFT + Qt::Key_Y); | ||
315 | QVERIFY(workspace()->shortcutAvailable(seq)); | 314 | QVERIFY(workspace()->shortcutAvailable(seq)); | ||
316 | client->setShortcut(seq.toString()); | 315 | client->setShortcut(seq.toString()); | ||
Show All 19 Lines | |||||
336 | surface.reset(); | 335 | surface.reset(); | ||
337 | QVERIFY(Test::waitForWindowDestroyed(client)); | 336 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
338 | QVERIFY(workspace()->shortcutAvailable(seq)); | 337 | QVERIFY(workspace()->shortcutAvailable(seq)); | ||
339 | } | 338 | } | ||
340 | 339 | | |||
341 | void GlobalShortcutsTest::testSetupWindowShortcut() | 340 | void GlobalShortcutsTest::testSetupWindowShortcut() | ||
342 | { | 341 | { | ||
343 | QScopedPointer<Surface> surface(Test::createSurface()); | 342 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
344 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 343 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
345 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 344 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
346 | 345 | | |||
347 | QCOMPARE(workspace()->activeClient(), client); | 346 | QCOMPARE(workspace()->activeClient(), client); | ||
348 | QVERIFY(client->isActive()); | 347 | QVERIFY(client->isActive()); | ||
349 | QCOMPARE(client->shortcut(), QKeySequence()); | 348 | QCOMPARE(client->shortcut(), QKeySequence()); | ||
350 | 349 | | |||
351 | QSignalSpy shortcutDialogAddedSpy(workspace(), &Workspace::internalClientAdded); | 350 | QSignalSpy shortcutDialogAddedSpy(workspace(), &Workspace::internalClientAdded); | ||
352 | QVERIFY(shortcutDialogAddedSpy.isValid()); | 351 | QVERIFY(shortcutDialogAddedSpy.isValid()); | ||
Show All 32 Lines |