KWin
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
kwin_wayland_test.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#ifndef KWIN_WAYLAND_TEST_H
10#define KWIN_WAYLAND_TEST_H
11
12#include "core/inputdevice.h"
13#include "main.h"
14#include "window.h"
15
16// Qt
17#include <QSignalSpy>
18#include <QTest>
19
20#include <KWayland/Client/surface.h>
21#include <optional>
22
23#include "qwayland-cursor-shape-v1.h"
24#include "qwayland-fake-input.h"
25#include "qwayland-fractional-scale-v1.h"
26#include "qwayland-idle-inhibit-unstable-v1.h"
27#include "qwayland-input-method-unstable-v1.h"
28#include "qwayland-kde-output-device-v2.h"
29#include "qwayland-kde-output-management-v2.h"
30#include "qwayland-kde-screen-edge-v1.h"
31#include "qwayland-security-context-v1.h"
32#include "qwayland-text-input-unstable-v3.h"
33#include "qwayland-wlr-layer-shell-unstable-v1.h"
34#include "qwayland-xdg-decoration-unstable-v1.h"
35#include "qwayland-xdg-shell.h"
36#include "qwayland-zkde-screencast-unstable-v1.h"
37
38namespace KWayland
39{
40namespace Client
41{
42class AppMenuManager;
43class ConnectionThread;
44class Compositor;
45class Output;
46class PlasmaShell;
47class PlasmaWindowManagement;
48class Pointer;
49class PointerConstraints;
50class Seat;
51class ShadowManager;
52class ShmPool;
53class SubCompositor;
54class SubSurface;
55class Surface;
56class TextInputManager;
57}
58}
59
60namespace QtWayland
61{
62class zwp_input_panel_surface_v1;
63class zwp_text_input_v3;
64class zwp_text_input_manager_v3;
65}
66
67class ScreencastingV1;
68
69namespace KWin
70{
71namespace Xwl
72{
73class Xwayland;
74}
75
76namespace Test
77{
79}
80
82{
83 Q_OBJECT
84public:
85 WaylandTestApplication(OperationMode mode, int &argc, char **argv);
86 ~WaylandTestApplication() override;
87
88 void setInputMethodServerToStart(const QString &inputMethodServer)
89 {
90 m_inputMethodServerToStart = inputMethodServer;
91 }
92
96 XwaylandInterface *xwayland() const override;
97
98protected:
99 void performStartup() override;
100
101private:
102 void continueStartupWithScene();
103 void finalizeStartup();
104
105 void createVirtualInputDevices();
106 void destroyVirtualInputDevices();
107
108 std::unique_ptr<Xwl::Xwayland> m_xwayland;
109 QString m_inputMethodServerToStart;
110
111 std::unique_ptr<Test::VirtualInputDevice> m_virtualPointer;
112 std::unique_ptr<Test::VirtualInputDevice> m_virtualKeyboard;
113 std::unique_ptr<Test::VirtualInputDevice> m_virtualTouch;
114};
115
116namespace Test
117{
118
119class ScreencastingV1;
120class MockInputMethod;
121
122class TextInputManagerV3 : public QtWayland::zwp_text_input_manager_v3
123{
124public:
126 {
127 destroy();
128 }
129};
130
131class TextInputV3 : public QObject, public QtWayland::zwp_text_input_v3
132{
133 Q_OBJECT
134public:
135 ~TextInputV3() override
136 {
137 destroy();
138 }
139
140Q_SIGNALS:
141 void preeditString(const QString &text, int cursor_begin, int cursor_end);
142
143protected:
144 void zwp_text_input_v3_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override
145 {
146 Q_EMIT preeditString(text, cursor_begin, cursor_end);
147 }
148};
149
150class LayerShellV1 : public QtWayland::zwlr_layer_shell_v1
151{
152public:
153 ~LayerShellV1() override;
154};
155
156class LayerSurfaceV1 : public QObject, public QtWayland::zwlr_layer_surface_v1
157{
158 Q_OBJECT
159
160public:
161 ~LayerSurfaceV1() override;
162
163protected:
164 void zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override;
165 void zwlr_layer_surface_v1_closed() override;
166
167Q_SIGNALS:
169 void configureRequested(quint32 serial, const QSize &size);
170};
171
175class XdgShell : public QtWayland::xdg_wm_base
176{
177public:
178 ~XdgShell() override;
179 void xdg_wm_base_ping(uint32_t serial) override
180 {
181 pong(serial);
182 }
183};
184
188class XdgSurface : public QObject, public QtWayland::xdg_surface
189{
190 Q_OBJECT
191
192public:
193 explicit XdgSurface(XdgShell *shell, KWayland::Client::Surface *surface, QObject *parent = nullptr);
194 ~XdgSurface() override;
195
196 KWayland::Client::Surface *surface() const;
197
198Q_SIGNALS:
199 void configureRequested(quint32 serial);
200
201protected:
202 void xdg_surface_configure(uint32_t serial) override;
203
204private:
205 KWayland::Client::Surface *m_surface;
206};
207
212class XdgToplevel : public QObject, public QtWayland::xdg_toplevel
213{
214 Q_OBJECT
215
216public:
217 enum class State {
218 Maximized = 1 << 0,
219 Fullscreen = 1 << 1,
220 Resizing = 1 << 2,
221 Activated = 1 << 3
222 };
223 Q_DECLARE_FLAGS(States, State)
224
225 explicit XdgToplevel(XdgSurface *surface, QObject *parent = nullptr);
226 ~XdgToplevel() override;
227
228 XdgSurface *xdgSurface() const;
229
230Q_SIGNALS:
231 void configureRequested(const QSize &size, KWin::Test::XdgToplevel::States states);
233
234protected:
235 void xdg_toplevel_configure(int32_t width, int32_t height, wl_array *states) override;
236 void xdg_toplevel_close() override;
237
238private:
239 std::unique_ptr<XdgSurface> m_xdgSurface;
240};
241
245class XdgPositioner : public QtWayland::xdg_positioner
246{
247public:
248 explicit XdgPositioner(XdgShell *shell);
249 ~XdgPositioner() override;
250};
251
256class XdgPopup : public QObject, public QtWayland::xdg_popup
257{
258 Q_OBJECT
259
260public:
261 XdgPopup(XdgSurface *surface, XdgSurface *parentSurface, XdgPositioner *positioner, QObject *parent = nullptr);
262 ~XdgPopup() override;
263
264 XdgSurface *xdgSurface() const;
265
266Q_SIGNALS:
267 void configureRequested(const QRect &rect);
269
270protected:
271 void xdg_popup_configure(int32_t x, int32_t y, int32_t width, int32_t height) override;
272 void xdg_popup_popup_done() override;
273
274private:
275 std::unique_ptr<XdgSurface> m_xdgSurface;
276};
277
278class XdgDecorationManagerV1 : public QtWayland::zxdg_decoration_manager_v1
279{
280public:
281 ~XdgDecorationManagerV1() override;
282};
283
284class XdgToplevelDecorationV1 : public QObject, public QtWayland::zxdg_toplevel_decoration_v1
285{
286 Q_OBJECT
287
288public:
289 XdgToplevelDecorationV1(XdgDecorationManagerV1 *manager, XdgToplevel *toplevel, QObject *parent = nullptr);
290 ~XdgToplevelDecorationV1() override;
291
292Q_SIGNALS:
293 void configureRequested(QtWayland::zxdg_toplevel_decoration_v1::mode mode);
294
295protected:
296 void zxdg_toplevel_decoration_v1_configure(uint32_t mode) override;
297};
298
299class IdleInhibitManagerV1 : public QtWayland::zwp_idle_inhibit_manager_v1
300{
301public:
302 ~IdleInhibitManagerV1() override;
303};
304
305class IdleInhibitorV1 : public QtWayland::zwp_idle_inhibitor_v1
306{
307public:
308 IdleInhibitorV1(IdleInhibitManagerV1 *manager, KWayland::Client::Surface *surface);
309 ~IdleInhibitorV1() override;
310};
311
312class WaylandOutputConfigurationV2 : public QObject, public QtWayland::kde_output_configuration_v2
313{
314 Q_OBJECT
315public:
316 WaylandOutputConfigurationV2(struct ::kde_output_configuration_v2 *object);
317
318Q_SIGNALS:
319 void applied();
320 void failed();
321
322protected:
325};
326
327class WaylandOutputManagementV2 : public QObject, public QtWayland::kde_output_management_v2
328{
329 Q_OBJECT
330public:
331 WaylandOutputManagementV2(struct ::wl_registry *registry, int id, int version);
332
334};
335
336class WaylandOutputDeviceV2Mode : public QObject, public QtWayland::kde_output_device_mode_v2
337{
338 Q_OBJECT
339
340public:
341 WaylandOutputDeviceV2Mode(struct ::kde_output_device_mode_v2 *object);
343
344 int refreshRate() const;
345 QSize size() const;
346 bool preferred() const;
347
348 bool operator==(const WaylandOutputDeviceV2Mode &other) const;
349
350 static WaylandOutputDeviceV2Mode *get(struct ::kde_output_device_mode_v2 *object);
351
352Q_SIGNALS:
353 void removed();
354
355protected:
356 void kde_output_device_mode_v2_size(int32_t width, int32_t height) override;
357 void kde_output_device_mode_v2_refresh(int32_t refresh) override;
359 void kde_output_device_mode_v2_removed() override;
360
361private:
362 int m_refreshRate = 60000;
363 QSize m_size;
364 bool m_preferred = false;
365};
366
367class WaylandOutputDeviceV2 : public QObject, public QtWayland::kde_output_device_v2
368{
369 Q_OBJECT
370
371public:
372 WaylandOutputDeviceV2(int id);
373 ~WaylandOutputDeviceV2() override;
374
375 QByteArray edid() const;
376 bool enabled() const;
377 int id() const;
378 QString name() const;
379 QString model() const;
380 QString manufacturer() const;
381 qreal scale() const;
382 QPoint globalPosition() const;
383 QSize pixelSize() const;
384 int refreshRate() const;
385 uint32_t vrrPolicy() const;
386 uint32_t overscan() const;
387 uint32_t capabilities() const;
388 uint32_t rgbRange() const;
389
390 QString modeId() const;
391
392Q_SIGNALS:
394 void done();
395
396protected:
397 void kde_output_device_v2_geometry(int32_t x,
398 int32_t y,
399 int32_t physical_width,
400 int32_t physical_height,
401 int32_t subpixel,
402 const QString &make,
403 const QString &model,
404 int32_t transform) override;
405 void kde_output_device_v2_current_mode(struct ::kde_output_device_mode_v2 *mode) override;
406 void kde_output_device_v2_mode(struct ::kde_output_device_mode_v2 *mode) override;
407 void kde_output_device_v2_done() override;
408 void kde_output_device_v2_scale(wl_fixed_t factor) override;
409 void kde_output_device_v2_edid(const QString &raw) override;
410 void kde_output_device_v2_enabled(int32_t enabled) override;
411 void kde_output_device_v2_uuid(const QString &uuid) override;
412 void kde_output_device_v2_serial_number(const QString &serialNumber) override;
413 void kde_output_device_v2_eisa_id(const QString &eisaId) override;
414 void kde_output_device_v2_capabilities(uint32_t flags) override;
415 void kde_output_device_v2_overscan(uint32_t overscan) override;
416 void kde_output_device_v2_vrr_policy(uint32_t vrr_policy) override;
417 void kde_output_device_v2_rgb_range(uint32_t rgb_range) override;
418
419private:
420 QString modeName(const WaylandOutputDeviceV2Mode *m) const;
421 WaylandOutputDeviceV2Mode *deviceModeFromId(const int modeId) const;
422
424 QList<WaylandOutputDeviceV2Mode *> m_modes;
425
426 int m_id;
427 QPoint m_pos;
428 QSize m_physicalSize;
429 int32_t m_subpixel;
430 QString m_manufacturer;
431 QString m_model;
432 int32_t m_transform;
433 qreal m_factor;
434 QByteArray m_edid;
435 int32_t m_enabled;
436 QString m_uuid;
437 QString m_serialNumber;
438 QString m_eisaId;
439 uint32_t m_flags;
440 uint32_t m_overscan;
441 uint32_t m_vrr_policy;
442 uint32_t m_rgbRange;
443};
444
445class MockInputMethod : public QObject, QtWayland::zwp_input_method_v1
446{
447 Q_OBJECT
448public:
449 enum class Mode {
450 TopLevel,
451 Overlay,
452 };
453
454 MockInputMethod(struct wl_registry *registry, int id, int version);
456
457 KWayland::Client::Surface *inputPanelSurface() const
458 {
459 return m_inputSurface.get();
460 }
461 auto *context() const
462 {
463 return m_context;
464 }
465
466 void setMode(Mode mode);
467
468Q_SIGNALS:
469 void activate();
470
471protected:
472 void zwp_input_method_v1_activate(struct ::zwp_input_method_context_v1 *context) override;
473 void zwp_input_method_v1_deactivate(struct ::zwp_input_method_context_v1 *context) override;
474
475private:
476 std::unique_ptr<KWayland::Client::Surface> m_inputSurface;
477 QtWayland::zwp_input_panel_surface_v1 *m_inputMethodSurface = nullptr;
478 struct ::zwp_input_method_context_v1 *m_context = nullptr;
479 Mode m_mode = Mode::TopLevel;
480};
481
482class FractionalScaleManagerV1 : public QObject, public QtWayland::wp_fractional_scale_manager_v1
483{
484 Q_OBJECT
485public:
486 ~FractionalScaleManagerV1() override;
487};
488
489class FractionalScaleV1 : public QObject, public QtWayland::wp_fractional_scale_v1
490{
491 Q_OBJECT
492public:
493 ~FractionalScaleV1() override;
494 int preferredScale();
495
496protected:
497 void wp_fractional_scale_v1_preferred_scale(uint32_t scale) override;
498
499private:
500 int m_preferredScale = 120;
501};
502
503class ScreenEdgeManagerV1 : public QObject, public QtWayland::kde_screen_edge_manager_v1
504{
505 Q_OBJECT
506public:
507 ~ScreenEdgeManagerV1() override;
508};
509
510class AutoHideScreenEdgeV1 : public QObject, public QtWayland::kde_auto_hide_screen_edge_v1
511{
512 Q_OBJECT
513public:
514 AutoHideScreenEdgeV1(ScreenEdgeManagerV1 *manager, KWayland::Client::Surface *surface, uint32_t border);
515 ~AutoHideScreenEdgeV1() override;
516};
517
518class CursorShapeManagerV1 : public QObject, public QtWayland::wp_cursor_shape_manager_v1
519{
520 Q_OBJECT
521public:
522 ~CursorShapeManagerV1() override;
523};
524
525class CursorShapeDeviceV1 : public QObject, public QtWayland::wp_cursor_shape_device_v1
526{
527 Q_OBJECT
528public:
529 CursorShapeDeviceV1(CursorShapeManagerV1 *manager, KWayland::Client::Pointer *pointer);
530 ~CursorShapeDeviceV1() override;
531};
532
533class FakeInput : public QtWayland::org_kde_kwin_fake_input
534{
535public:
536 ~FakeInput() override;
537};
538
539class SecurityContextManagerV1 : public QtWayland::wp_security_context_manager_v1
540{
541public:
542 ~SecurityContextManagerV1() override;
543};
544
546 Seat = 1 << 0,
547 PlasmaShell = 1 << 2,
548 WindowManagement = 1 << 3,
549 PointerConstraints = 1 << 4,
550 IdleInhibitV1 = 1 << 5,
551 AppMenu = 1 << 6,
552 ShadowManager = 1 << 7,
553 XdgDecorationV1 = 1 << 8,
554 OutputManagementV2 = 1 << 9,
555 TextInputManagerV2 = 1 << 10,
556 InputMethodV1 = 1 << 11,
557 LayerShellV1 = 1 << 12,
558 TextInputManagerV3 = 1 << 13,
559 OutputDeviceV2 = 1 << 14,
560 FractionalScaleManagerV1 = 1 << 15,
561 ScreencastingV1 = 1 << 16,
562 ScreenEdgeV1 = 1 << 17,
563 CursorShapeV1 = 1 << 18,
564 FakeInput = 1 << 19,
565 SecurityContextManagerV1 = 1 << 20,
566};
567Q_DECLARE_FLAGS(AdditionalWaylandInterfaces, AdditionalWaylandInterface)
568
570{
571 Q_OBJECT
572
573public:
574 explicit VirtualInputDevice(QObject *parent = nullptr);
575
576 void setPointer(bool set);
577 void setKeyboard(bool set);
578 void setTouch(bool set);
579 void setLidSwitch(bool set);
580 void setName(const QString &name);
581
582 QString sysName() const override;
583 QString name() const override;
584
585 bool isEnabled() const override;
586 void setEnabled(bool enabled) override;
587
588 LEDs leds() const override;
589 void setLeds(LEDs leds) override;
590
591 bool isKeyboard() const override;
592 bool isPointer() const override;
593 bool isTouchpad() const override;
594 bool isTouch() const override;
595 bool isTabletTool() const override;
596 bool isTabletPad() const override;
597 bool isTabletModeSwitch() const override;
598 bool isLidSwitch() const override;
599
600private:
601 QString m_name;
602 bool m_pointer = false;
603 bool m_keyboard = false;
604 bool m_touch = false;
605 bool m_lidSwitch = false;
606};
607
608void keyboardKeyPressed(quint32 key, quint32 time);
609void keyboardKeyReleased(quint32 key, quint32 time);
610void pointerAxisHorizontal(qreal delta,
611 quint32 time,
612 qint32 discreteDelta = 0,
614void pointerAxisVertical(qreal delta,
615 quint32 time,
616 qint32 discreteDelta = 0,
618void pointerButtonPressed(quint32 button, quint32 time);
619void pointerButtonReleased(quint32 button, quint32 time);
620void pointerMotion(const QPointF &position, quint32 time);
621void pointerMotionRelative(const QPointF &delta, quint32 time);
622void touchCancel();
623void touchDown(qint32 id, const QPointF &pos, quint32 time);
624void touchMotion(qint32 id, const QPointF &pos, quint32 time);
625void touchUp(qint32 id, quint32 time);
626
633bool setupWaylandConnection(AdditionalWaylandInterfaces flags = AdditionalWaylandInterfaces());
634
642
643KWayland::Client::ConnectionThread *waylandConnection();
644KWayland::Client::Compositor *waylandCompositor();
645KWayland::Client::SubCompositor *waylandSubCompositor();
646KWayland::Client::ShadowManager *waylandShadowManager();
647KWayland::Client::ShmPool *waylandShmPool();
648KWayland::Client::Seat *waylandSeat();
649KWayland::Client::PlasmaShell *waylandPlasmaShell();
650KWayland::Client::PlasmaWindowManagement *waylandWindowManagement();
651KWayland::Client::PointerConstraints *waylandPointerConstraints();
652KWayland::Client::AppMenuManager *waylandAppMenuManager();
654KWayland::Client::TextInputManager *waylandTextInputManager();
655QList<KWayland::Client::Output *> waylandOutputs();
656KWayland::Client::Output *waylandOutput(const QString &name);
658QList<WaylandOutputDeviceV2 *> waylandOutputDevicesV2();
661
662bool waitForWaylandSurface(Window *window);
663
667
669
674bool waylandSync();
675
676std::unique_ptr<KWayland::Client::Surface> createSurface();
677KWayland::Client::SubSurface *createSubSurface(KWayland::Client::Surface *surface,
678 KWayland::Client::Surface *parentSurface, QObject *parent = nullptr);
679
680LayerSurfaceV1 *createLayerSurfaceV1(KWayland::Client::Surface *surface,
681 const QString &scope,
682 KWayland::Client::Output *output = nullptr,
683 LayerShellV1::layer layer = LayerShellV1::layer_top);
684
686
687enum class CreationSetup {
690};
691
692QtWayland::zwp_input_panel_surface_v1 *createInputPanelSurfaceV1(KWayland::Client::Surface *surface,
693 KWayland::Client::Output *output,
695
696FractionalScaleV1 *createFractionalScaleV1(KWayland::Client::Surface *surface);
697
698XdgToplevel *createXdgToplevelSurface(KWayland::Client::Surface *surface, QObject *parent = nullptr);
699XdgToplevel *createXdgToplevelSurface(KWayland::Client::Surface *surface,
700 CreationSetup configureMode,
701 QObject *parent = nullptr);
702
704
705XdgPopup *createXdgPopupSurface(KWayland::Client::Surface *surface, XdgSurface *parentSurface,
706 XdgPositioner *positioner,
708 QObject *parent = nullptr);
709
710XdgToplevelDecorationV1 *createXdgToplevelDecorationV1(XdgToplevel *toplevel, QObject *parent = nullptr);
711IdleInhibitorV1 *createIdleInhibitorV1(KWayland::Client::Surface *surface);
712AutoHideScreenEdgeV1 *createAutoHideScreenEdgeV1(KWayland::Client::Surface *surface, uint32_t border);
713CursorShapeDeviceV1 *createCursorShapeDeviceV1(KWayland::Client::Pointer *pointer);
714
719void render(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format = QImage::Format_ARGB32_Premultiplied);
720
724void render(KWayland::Client::Surface *surface, const QImage &img);
725
730Window *waitForWaylandWindowShown(int timeout = 5000);
731
735Window *renderAndWaitForShown(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format = QImage::Format_ARGB32, int timeout = 5000);
736
737Window *renderAndWaitForShown(KWayland::Client::Surface *surface, const QImage &img, int timeout = 5000);
738
742bool waitForWindowClosed(Window *window);
743
749
755
762
770{
771 void operator()(xcb_connection_t *pointer);
772};
773
774typedef std::unique_ptr<xcb_connection_t, XcbConnectionDeleter> XcbConnectionPtr;
776
778KWayland::Client::Surface *inputPanelSurface();
779
780class ScreencastingStreamV1 : public QObject, public QtWayland::zkde_screencast_stream_unstable_v1
781{
782 Q_OBJECT
783 friend class ScreencastingV1;
784
785public:
786 ScreencastingStreamV1(QObject *parent)
787 : QObject(parent)
788 {
789 }
790
792 {
793 if (isInitialized()) {
794 close();
795 }
796 }
797
798 quint32 nodeId() const
799 {
800 Q_ASSERT(m_nodeId.has_value());
801 return *m_nodeId;
802 }
803
805 {
806 m_nodeId = node;
807 Q_EMIT created(node);
808 }
809
811 {
812 Q_EMIT closed();
813 }
814
815 void zkde_screencast_stream_unstable_v1_failed(const QString &error) override
816 {
817 Q_EMIT failed(error);
818 }
819
820Q_SIGNALS:
821 void created(quint32 nodeid);
822 void failed(const QString &error);
823 void closed();
824
825private:
826 std::optional<uint> m_nodeId;
827};
828
829class ScreencastingV1 : public QObject, public QtWayland::zkde_screencast_unstable_v1
830{
831 Q_OBJECT
832public:
833 explicit ScreencastingV1(QObject *parent = nullptr)
834 : QObject(parent)
835 {
836 }
837
838 ScreencastingStreamV1 *createOutputStream(wl_output *output, pointer mode)
839 {
840 auto stream = new ScreencastingStreamV1(this);
841 stream->init(stream_output(output, mode));
842 return stream;
843 }
844
845 ScreencastingStreamV1 *createWindowStream(const QString &uuid, pointer mode)
846 {
847 auto stream = new ScreencastingStreamV1(this);
848 stream->init(stream_window(uuid, mode));
849 return stream;
850 }
851};
852
854{
855 QRect geometry;
856 double scale = 1;
857 bool internal = false;
858};
859void setOutputConfig(const QList<QRect> &geometries);
860void setOutputConfig(const QList<OutputInfo> &infos);
861}
862
863}
864
865Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Test::AdditionalWaylandInterfaces)
866Q_DECLARE_METATYPE(KWin::Test::XdgToplevel::States)
867Q_DECLARE_METATYPE(QtWayland::zxdg_toplevel_decoration_v1::mode)
868
869#define WAYLANDTEST_MAIN(TestObject) \
870 int main(int argc, char *argv[]) \
871 { \
872 setenv("QT_QPA_PLATFORM", "wayland-org.kde.kwin.qpa", true); \
873 setenv("QT_QPA_PLATFORM_PLUGIN_PATH", QFileInfo(QString::fromLocal8Bit(argv[0])).absolutePath().toLocal8Bit().constData(), true); \
874 setenv("KWIN_FORCE_OWN_QPA", "1", true); \
875 qunsetenv("KDE_FULL_SESSION"); \
876 qunsetenv("KDE_SESSION_VERSION"); \
877 qunsetenv("XDG_SESSION_DESKTOP"); \
878 qunsetenv("XDG_CURRENT_DESKTOP"); \
879 KWin::WaylandTestApplication app(KWin::Application::OperationModeXwayland, argc, argv); \
880 app.setAttribute(Qt::AA_Use96Dpi, true); \
881 TestObject tc; \
882 return QTest::qExec(&tc, argc, argv); \
883 }
884
885#endif
The Client class encapsulates a window decoration frame.
OperationMode
This enum provides the various operation modes of KWin depending on the available Windowing Systems a...
Definition main.h:83
AutoHideScreenEdgeV1(ScreenEdgeManagerV1 *manager, KWayland::Client::Surface *surface, uint32_t border)
CursorShapeDeviceV1(CursorShapeManagerV1 *manager, KWayland::Client::Pointer *pointer)
void wp_fractional_scale_v1_preferred_scale(uint32_t scale) override
IdleInhibitorV1(IdleInhibitManagerV1 *manager, KWayland::Client::Surface *surface)
void zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override
void zwlr_layer_surface_v1_closed() override
void configureRequested(quint32 serial, const QSize &size)
KWayland::Client::Surface * inputPanelSurface() const
void zwp_input_method_v1_deactivate(struct ::zwp_input_method_context_v1 *context) override
MockInputMethod(struct wl_registry *registry, int id, int version)
void zwp_input_method_v1_activate(struct ::zwp_input_method_context_v1 *context) override
void zkde_screencast_stream_unstable_v1_closed() override
void zkde_screencast_stream_unstable_v1_created(uint32_t node) override
void failed(const QString &error)
void created(quint32 nodeid)
void zkde_screencast_stream_unstable_v1_failed(const QString &error) override
ScreencastingV1(QObject *parent=nullptr)
ScreencastingStreamV1 * createOutputStream(wl_output *output, pointer mode)
ScreencastingStreamV1 * createWindowStream(const QString &uuid, pointer mode)
void zwp_text_input_v3_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override
void preeditString(const QString &text, int cursor_begin, int cursor_end)
WaylandOutputConfigurationV2(struct ::kde_output_configuration_v2 *object)
void kde_output_device_v2_uuid(const QString &uuid) override
void kde_output_device_v2_eisa_id(const QString &eisaId) override
void kde_output_device_v2_scale(wl_fixed_t factor) override
void kde_output_device_v2_capabilities(uint32_t flags) override
void kde_output_device_v2_geometry(int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const QString &make, const QString &model, int32_t transform) override
void kde_output_device_v2_mode(struct ::kde_output_device_mode_v2 *mode) override
void kde_output_device_v2_overscan(uint32_t overscan) override
void kde_output_device_v2_enabled(int32_t enabled) override
void kde_output_device_v2_edid(const QString &raw) override
void kde_output_device_v2_rgb_range(uint32_t rgb_range) override
void kde_output_device_v2_serial_number(const QString &serialNumber) override
void kde_output_device_v2_vrr_policy(uint32_t vrr_policy) override
void kde_output_device_v2_current_mode(struct ::kde_output_device_mode_v2 *mode) override
WaylandOutputDeviceV2Mode(struct ::kde_output_device_mode_v2 *object)
bool operator==(const WaylandOutputDeviceV2Mode &other) const
void kde_output_device_mode_v2_refresh(int32_t refresh) override
void kde_output_device_mode_v2_size(int32_t width, int32_t height) override
static WaylandOutputDeviceV2Mode * get(struct ::kde_output_device_mode_v2 *object)
WaylandOutputManagementV2(struct ::wl_registry *registry, int id, int version)
WaylandOutputConfigurationV2 * createConfiguration()
XdgPopup(XdgSurface *surface, XdgSurface *parentSurface, XdgPositioner *positioner, QObject *parent=nullptr)
void configureRequested(const QRect &rect)
void xdg_popup_configure(int32_t x, int32_t y, int32_t width, int32_t height) override
XdgSurface * xdgSurface() const
void xdg_popup_popup_done() override
XdgPositioner(XdgShell *shell)
void xdg_wm_base_ping(uint32_t serial) override
void xdg_surface_configure(uint32_t serial) override
KWayland::Client::Surface * surface() const
void configureRequested(quint32 serial)
XdgSurface(XdgShell *shell, KWayland::Client::Surface *surface, QObject *parent=nullptr)
void configureRequested(QtWayland::zxdg_toplevel_decoration_v1::mode mode)
XdgToplevelDecorationV1(XdgDecorationManagerV1 *manager, XdgToplevel *toplevel, QObject *parent=nullptr)
void zxdg_toplevel_decoration_v1_configure(uint32_t mode) override
XdgSurface * xdgSurface() const
void xdg_toplevel_close() override
void xdg_toplevel_configure(int32_t width, int32_t height, wl_array *states) override
void configureRequested(const QSize &size, KWin::Test::XdgToplevel::States states)
XdgToplevel(XdgSurface *surface, QObject *parent=nullptr)
XwaylandInterface * xwayland() const override
Test::VirtualInputDevice * virtualPointer() const
void setInputMethodServerToStart(const QString &inputMethodServer)
Test::VirtualInputDevice * virtualTouch() const
Test::VirtualInputDevice * virtualKeyboard() const
WaylandTestApplication(OperationMode mode, int &argc, char **argv)
Q_DECLARE_METATYPE(KWin::SwitchEvent::State)
WaylandOutputManagementV2 * waylandOutputManagementV2()
XdgPositioner * createXdgPositioner()
Window * renderAndWaitForShown(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format=QImage::Format_ARGB32, int timeout=5000)
void keyboardKeyReleased(quint32 key, quint32 time)
XdgPopup * createXdgPopupSurface(KWayland::Client::Surface *surface, XdgSurface *parentSurface, XdgPositioner *positioner, CreationSetup configureMode=CreationSetup::CreateAndConfigure, QObject *parent=nullptr)
void destroyWaylandConnection()
void setOutputConfig(const QList< QRect > &geometries)
void touchDown(qint32 id, const QPointF &pos, quint32 time)
void pointerAxisVertical(qreal delta, quint32 time, qint32 discreteDelta=0, InputRedirection::PointerAxisSource source=InputRedirection::PointerAxisSourceUnknown)
void keyboardKeyPressed(quint32 key, quint32 time)
TextInputManagerV3 * waylandTextInputManagerV3()
QtWayland::zwp_input_panel_surface_v1 * createInputPanelSurfaceV1(KWayland::Client::Surface *surface, KWayland::Client::Output *output, MockInputMethod::Mode mode)
bool waitForWaylandKeyboard()
QList< WaylandOutputDeviceV2 * > waylandOutputDevicesV2()
bool setupWaylandConnection(AdditionalWaylandInterfaces flags=AdditionalWaylandInterfaces())
void touchMotion(qint32 id, const QPointF &pos, quint32 time)
KWayland::Client::PlasmaWindowManagement * waylandWindowManagement()
KWayland::Client::Compositor * waylandCompositor()
KWayland::Client::SubCompositor * waylandSubCompositor()
KWayland::Client::PointerConstraints * waylandPointerConstraints()
void render(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format=QImage::Format_ARGB32_Premultiplied)
bool waitForWaylandSurface(Window *window)
void pointerAxisHorizontal(qreal delta, quint32 time, qint32 discreteDelta=0, InputRedirection::PointerAxisSource source=InputRedirection::PointerAxisSourceUnknown)
KWayland::Client::Seat * waylandSeat()
LayerSurfaceV1 * createLayerSurfaceV1(KWayland::Client::Surface *surface, const QString &scope, KWayland::Client::Output *output=nullptr, LayerShellV1::layer layer=LayerShellV1::layer_top)
SecurityContextManagerV1 * waylandSecurityContextManagerV1()
KWayland::Client::Registry * registry
ScreencastingV1 * screencasting()
Window * waitForWaylandWindowShown(int timeout=5000)
bool waitForWaylandTouch()
AutoHideScreenEdgeV1 * createAutoHideScreenEdgeV1(KWayland::Client::Surface *surface, uint32_t border)
MockInputMethod * inputMethod()
QList< KWayland::Client::Output * > waylandOutputs()
KWayland::Client::Surface * inputPanelSurface()
void pointerButtonPressed(quint32 button, quint32 time)
bool unlockScreen()
KWayland::Client::ShadowManager * waylandShadowManager()
XcbConnectionPtr createX11Connection()
void pointerMotion(const QPointF &position, quint32 time)
bool renderNodeAvailable()
std::unique_ptr< KWayland::Client::Surface > createSurface()
KWayland::Client::ShmPool * waylandShmPool()
void pointerMotionRelative(const QPointF &delta, quint32 time)
XdgToplevel * createXdgToplevelSurface(KWayland::Client::Surface *surface, QObject *parent=nullptr)
IdleInhibitorV1 * createIdleInhibitorV1(KWayland::Client::Surface *surface)
XdgToplevelDecorationV1 * createXdgToplevelDecorationV1(XdgToplevel *toplevel, QObject *parent=nullptr)
KWayland::Client::AppMenuManager * waylandAppMenuManager()
FractionalScaleV1 * createFractionalScaleV1(KWayland::Client::Surface *surface)
KWayland::Client::SubSurface * createSubSurface(KWayland::Client::Surface *surface, KWayland::Client::Surface *parentSurface, QObject *parent=nullptr)
bool waylandSync()
bool waitForWaylandPointer()
bool lockScreen()
KWayland::Client::ConnectionThread * waylandConnection()
KWayland::Client::TextInputManager * waylandTextInputManager()
void pointerButtonReleased(quint32 button, quint32 time)
void touchUp(qint32 id, quint32 time)
CursorShapeDeviceV1 * createCursorShapeDeviceV1(KWayland::Client::Pointer *pointer)
void flushWaylandConnection()
KWayland::Client::PlasmaShell * waylandPlasmaShell()
std::unique_ptr< xcb_connection_t, XcbConnectionDeleter > XcbConnectionPtr
bool waitForWindowClosed(Window *window)
KWayland::Client::Output * waylandOutput(const QString &name)
FakeInput * waylandFakeInput()
constexpr int version
GLenum format
Definition gltexture.cpp:49
void operator()(xcb_connection_t *pointer)