9#include <config-kwin.h>
15#if KWIN_BUILD_SCREENLOCKER
22#include <wayland-zkde-screencast-unstable-v1-client-protocol.h>
24#include <KWayland/Client/appmenu.h>
25#include <KWayland/Client/compositor.h>
26#include <KWayland/Client/connection_thread.h>
27#include <KWayland/Client/event_queue.h>
28#include <KWayland/Client/output.h>
29#include <KWayland/Client/plasmashell.h>
30#include <KWayland/Client/plasmawindowmanagement.h>
31#include <KWayland/Client/pointer.h>
32#include <KWayland/Client/pointerconstraints.h>
33#include <KWayland/Client/registry.h>
34#include <KWayland/Client/seat.h>
35#include <KWayland/Client/shadow.h>
36#include <KWayland/Client/shm_pool.h>
37#include <KWayland/Client/subcompositor.h>
38#include <KWayland/Client/subsurface.h>
39#include <KWayland/Client/surface.h>
40#include <KWayland/Client/textinput.h>
43#if KWIN_BUILD_SCREENLOCKER
44#include <KScreenLocker/KsldApp>
47#include <QFutureWatcher>
49#include <QtConcurrentRun>
52#include <sys/socket.h>
89 ,
QtWayland::xdg_surface(shell->get_xdg_surface(*surface))
111 ,
QtWayland::xdg_toplevel(surface->get_toplevel())
112 , m_xdgSurface(surface)
123 return m_xdgSurface.get();
128 States requestedStates;
130 const uint32_t *stateData =
static_cast<const uint32_t *
>(states->data);
131 const size_t stateCount = states->size /
sizeof(uint32_t);
133 for (
size_t i = 0; i < stateCount; ++i) {
134 switch (stateData[i]) {
135 case QtWayland::xdg_toplevel::state_maximized:
138 case QtWayland::xdg_toplevel::state_fullscreen:
141 case QtWayland::xdg_toplevel::state_resizing:
144 case QtWayland::xdg_toplevel::state_activated:
159 :
QtWayland::xdg_positioner(shell->create_positioner())
170 ,
QtWayland::xdg_popup(surface->get_popup(parentSurface->object(), positioner->object()))
171 , m_xdgSurface(surface)
182 return m_xdgSurface.get();
203 ,
QtWayland::zxdg_toplevel_decoration_v1(manager->get_toplevel_decoration(toplevel->object()))
223 :
QtWayland::zwp_idle_inhibitor_v1(manager->create_inhibitor(*surface))
238 :
QtWayland::kde_auto_hide_screen_edge_v1(manager->get_auto_hide_screen_edge(border, *surface))
253 :
QtWayland::wp_cursor_shape_device_v1(manager->get_pointer(*pointer))
275 KWayland::Client::EventQueue *
queue =
nullptr;
280 KWayland::Client::ShmPool *
shm =
nullptr;
281 KWayland::Client::Seat *
seat =
nullptr;
291 KWayland::Client::AppMenuManager *
appMenu =
nullptr;
305} s_waylandConnection;
309 return s_waylandConnection.inputMethodV1;
314 return s_waylandConnection.inputMethodV1->inputPanelSurface();
327 if (!m_inputSurface) {
335 Test::render(m_inputSurface.get(), QSize(1280, 400), Qt::blue);
338 Test::render(m_inputSurface.get(), QSize(200, 50), Qt::blue);
353 zwp_input_method_context_v1_destroy(
context);
356 if (m_inputSurface) {
357 m_inputSurface->release();
358 m_inputSurface->destroy();
359 m_inputSurface.reset();
360 delete m_inputMethodSurface;
361 m_inputMethodSurface =
nullptr;
367 if (s_waylandConnection.connection) {
372 if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sx) < 0) {
377 s_waylandConnection.connection =
new KWayland::Client::ConnectionThread;
378 QSignalSpy connectedSpy(s_waylandConnection.connection, &KWayland::Client::ConnectionThread::connected);
379 if (!connectedSpy.isValid()) {
382 s_waylandConnection.connection->setSocketFd(sx[1]);
384 s_waylandConnection.thread =
new QThread(kwinApp());
385 s_waylandConnection.connection->moveToThread(s_waylandConnection.thread);
386 s_waylandConnection.thread->start();
388 s_waylandConnection.connection->initConnection();
389 if (!connectedSpy.wait()) {
393 s_waylandConnection.queue =
new KWayland::Client::EventQueue;
394 s_waylandConnection.queue->setup(s_waylandConnection.connection);
395 if (!s_waylandConnection.queue->isValid()) {
399 KWayland::Client::Registry *
registry =
new KWayland::Client::Registry;
400 s_waylandConnection.registry =
registry;
401 registry->setEventQueue(s_waylandConnection.queue);
403 QObject::connect(
registry, &KWayland::Client::Registry::outputAnnounced, [=](quint32 name, quint32
version) {
404 KWayland::Client::Output *output =
registry->createOutput(name,
version, s_waylandConnection.registry);
405 s_waylandConnection.outputs << output;
406 QObject::connect(output, &KWayland::Client::Output::removed, [=]() {
407 output->deleteLater();
408 s_waylandConnection.outputs.removeOne(output);
410 QObject::connect(output, &KWayland::Client::Output::destroyed, [=]() {
411 s_waylandConnection.outputs.removeOne(output);
415 QObject::connect(
registry, &KWayland::Client::Registry::interfaceAnnounced, [=](
const QByteArray &interface, quint32 name, quint32
version) {
417 if (interface == QByteArrayLiteral(
"zwp_input_method_v1")) {
419 }
else if (interface == QByteArrayLiteral(
"zwp_input_panel_v1")) {
420 s_waylandConnection.inputPanelV1 =
new QtWayland::zwp_input_panel_v1(*
registry, name,
version);
424 if (interface == QByteArrayLiteral(
"zwlr_layer_shell_v1")) {
431 if (interface == QByteArrayLiteral(
"zwp_text_input_manager_v3")) {
433 s_waylandConnection.textInputManagerV3->init(*
registry, name,
version);
436 if (interface == QByteArrayLiteral(
"xdg_wm_base")) {
437 s_waylandConnection.xdgShell =
new XdgShell();
441 if (interface == zxdg_decoration_manager_v1_interface.name) {
443 s_waylandConnection.xdgDecorationManagerV1->init(*
registry, name,
version);
448 if (interface == zwp_idle_inhibit_manager_v1_interface.name) {
450 s_waylandConnection.idleInhibitManagerV1->init(*
registry, name,
version);
455 if (interface == kde_output_device_v2_interface.name) {
459 s_waylandConnection.outputDevicesV2 << device;
461 QObject::connect(device, &WaylandOutputDeviceV2::destroyed, [=]() {
462 s_waylandConnection.outputDevicesV2.removeOne(device);
463 device->deleteLater();
466 QObject::connect(
registry, &KWayland::Client::Registry::interfaceRemoved, device, [name, device](
const quint32 &interfaceName) {
467 if (name == interfaceName) {
468 s_waylandConnection.outputDevicesV2.removeOne(device);
469 device->deleteLater();
477 if (interface == kde_output_management_v2_interface.name) {
483 if (interface == wp_fractional_scale_manager_v1_interface.name) {
485 s_waylandConnection.fractionalScaleManagerV1->init(*
registry, name,
version);
490 if (interface == zkde_screencast_unstable_v1_interface.name) {
497 if (interface == kde_screen_edge_manager_v1_interface.name) {
499 s_waylandConnection.screenEdgeManagerV1->init(*
registry, name,
version);
504 if (interface == wp_cursor_shape_manager_v1_interface.name) {
506 s_waylandConnection.cursorShapeManagerV1->init(*
registry, name,
version);
510 if (interface == org_kde_kwin_fake_input_interface.name) {
511 s_waylandConnection.fakeInput =
new FakeInput();
516 if (interface == wp_security_context_manager_v1_interface.name) {
518 s_waylandConnection.securityContextManagerV1->init(*
registry, name,
version);
523 QSignalSpy allAnnounced(
registry, &KWayland::Client::Registry::interfacesAnnounced);
524 if (!allAnnounced.isValid()) {
527 registry->create(s_waylandConnection.connection);
532 if (!allAnnounced.wait()) {
536 s_waylandConnection.compositor =
registry->createCompositor(
registry->interface(KWayland::Client::Registry::Interface::Compositor).name,
registry->interface(KWayland::Client::Registry::Interface::Compositor).version);
537 if (!s_waylandConnection.compositor->isValid()) {
540 s_waylandConnection.subCompositor =
registry->createSubCompositor(
registry->interface(KWayland::Client::Registry::Interface::SubCompositor).name,
registry->interface(KWayland::Client::Registry::Interface::SubCompositor).version);
541 if (!s_waylandConnection.subCompositor->isValid()) {
544 s_waylandConnection.shm =
registry->createShmPool(
registry->interface(KWayland::Client::Registry::Interface::Shm).name,
registry->interface(KWayland::Client::Registry::Interface::Shm).version);
545 if (!s_waylandConnection.shm->isValid()) {
549 s_waylandConnection.seat =
registry->createSeat(
registry->interface(KWayland::Client::Registry::Interface::Seat).name,
registry->interface(KWayland::Client::Registry::Interface::Seat).version);
550 if (!s_waylandConnection.seat->isValid()) {
555 s_waylandConnection.shadowManager =
registry->createShadowManager(
registry->interface(KWayland::Client::Registry::Interface::Shadow).name,
556 registry->interface(KWayland::Client::Registry::Interface::Shadow).version);
557 if (!s_waylandConnection.shadowManager->isValid()) {
562 s_waylandConnection.plasmaShell =
registry->createPlasmaShell(
registry->interface(KWayland::Client::Registry::Interface::PlasmaShell).name,
563 registry->interface(KWayland::Client::Registry::Interface::PlasmaShell).version);
564 if (!s_waylandConnection.plasmaShell->isValid()) {
569 s_waylandConnection.windowManagement =
registry->createPlasmaWindowManagement(
registry->interface(KWayland::Client::Registry::Interface::PlasmaWindowManagement).name,
570 registry->interface(KWayland::Client::Registry::Interface::PlasmaWindowManagement).version);
571 if (!s_waylandConnection.windowManagement->isValid()) {
576 s_waylandConnection.pointerConstraints =
registry->createPointerConstraints(
registry->interface(KWayland::Client::Registry::Interface::PointerConstraintsUnstableV1).name,
577 registry->interface(KWayland::Client::Registry::Interface::PointerConstraintsUnstableV1).version);
578 if (!s_waylandConnection.pointerConstraints->isValid()) {
583 s_waylandConnection.appMenu =
registry->createAppMenuManager(
registry->interface(KWayland::Client::Registry::Interface::AppMenu).name,
registry->interface(KWayland::Client::Registry::Interface::AppMenu).version);
584 if (!s_waylandConnection.appMenu->isValid()) {
589 s_waylandConnection.textInputManager =
registry->createTextInputManager(
registry->interface(KWayland::Client::Registry::Interface::TextInputManagerUnstableV2).name,
registry->interface(KWayland::Client::Registry::Interface::TextInputManagerUnstableV2).version);
590 if (!s_waylandConnection.textInputManager->isValid()) {
600 delete s_waylandConnection.compositor;
601 s_waylandConnection.compositor =
nullptr;
602 delete s_waylandConnection.subCompositor;
603 s_waylandConnection.subCompositor =
nullptr;
604 delete s_waylandConnection.windowManagement;
605 s_waylandConnection.windowManagement =
nullptr;
606 delete s_waylandConnection.plasmaShell;
607 s_waylandConnection.plasmaShell =
nullptr;
608 delete s_waylandConnection.seat;
609 s_waylandConnection.seat =
nullptr;
610 delete s_waylandConnection.pointerConstraints;
611 s_waylandConnection.pointerConstraints =
nullptr;
612 delete s_waylandConnection.xdgShell;
613 s_waylandConnection.xdgShell =
nullptr;
614 delete s_waylandConnection.shadowManager;
615 s_waylandConnection.shadowManager =
nullptr;
616 delete s_waylandConnection.idleInhibitManagerV1;
617 s_waylandConnection.idleInhibitManagerV1 =
nullptr;
618 delete s_waylandConnection.shm;
619 s_waylandConnection.shm =
nullptr;
620 delete s_waylandConnection.registry;
621 s_waylandConnection.registry =
nullptr;
622 delete s_waylandConnection.appMenu;
623 s_waylandConnection.appMenu =
nullptr;
624 delete s_waylandConnection.xdgDecorationManagerV1;
625 s_waylandConnection.xdgDecorationManagerV1 =
nullptr;
626 delete s_waylandConnection.textInputManager;
627 s_waylandConnection.textInputManager =
nullptr;
628 delete s_waylandConnection.inputPanelV1;
629 s_waylandConnection.inputPanelV1 =
nullptr;
630 delete s_waylandConnection.layerShellV1;
631 s_waylandConnection.layerShellV1 =
nullptr;
632 delete s_waylandConnection.outputManagementV2;
633 s_waylandConnection.outputManagementV2 =
nullptr;
634 delete s_waylandConnection.fractionalScaleManagerV1;
635 s_waylandConnection.fractionalScaleManagerV1 =
nullptr;
636 delete s_waylandConnection.screencastingV1;
637 s_waylandConnection.screencastingV1 =
nullptr;
638 delete s_waylandConnection.screenEdgeManagerV1;
639 s_waylandConnection.screenEdgeManagerV1 =
nullptr;
640 delete s_waylandConnection.cursorShapeManagerV1;
641 s_waylandConnection.cursorShapeManagerV1 =
nullptr;
642 delete s_waylandConnection.fakeInput;
643 s_waylandConnection.fakeInput =
nullptr;
644 delete s_waylandConnection.securityContextManagerV1;
645 s_waylandConnection.securityContextManagerV1 =
nullptr;
647 delete s_waylandConnection.queue;
648 s_waylandConnection.queue =
nullptr;
650 if (s_waylandConnection.thread) {
651 s_waylandConnection.connection->deleteLater();
652 s_waylandConnection.thread->quit();
653 s_waylandConnection.thread->wait();
654 delete s_waylandConnection.thread;
655 s_waylandConnection.thread =
nullptr;
656 s_waylandConnection.connection =
nullptr;
658 s_waylandConnection.outputs.clear();
659 s_waylandConnection.outputDevicesV2.clear();
664 return s_waylandConnection.connection;
669 return s_waylandConnection.compositor;
674 return s_waylandConnection.subCompositor;
679 return s_waylandConnection.shadowManager;
684 return s_waylandConnection.shm;
689 return s_waylandConnection.seat;
694 return s_waylandConnection.plasmaShell;
699 return s_waylandConnection.windowManagement;
704 return s_waylandConnection.pointerConstraints;
709 return s_waylandConnection.appMenu;
714 return s_waylandConnection.outputManagementV2;
719 return s_waylandConnection.textInputManager;
724 return s_waylandConnection.textInputManagerV3;
729 return s_waylandConnection.outputs;
734 for (KWayland::Client::Output *output : std::as_const(s_waylandConnection.outputs)) {
735 if (output->name() == name) {
744 return s_waylandConnection.screencastingV1;
749 return s_waylandConnection.outputDevicesV2;
754 return s_waylandConnection.fakeInput;
759 return s_waylandConnection.securityContextManagerV1;
768 return surfaceChangedSpy.wait();
773 if (!s_waylandConnection.seat) {
776 QSignalSpy hasPointerSpy(s_waylandConnection.seat, &KWayland::Client::Seat::hasPointerChanged);
777 if (!hasPointerSpy.isValid()) {
780 return hasPointerSpy.wait();
785 if (!s_waylandConnection.seat) {
788 QSignalSpy hasTouchSpy(s_waylandConnection.seat, &KWayland::Client::Seat::hasTouchChanged);
789 if (!hasTouchSpy.isValid()) {
792 return hasTouchSpy.wait();
797 if (!s_waylandConnection.seat) {
800 QSignalSpy hasKeyboardSpy(s_waylandConnection.seat, &KWayland::Client::Seat::hasKeyboardChanged);
801 if (!hasKeyboardSpy.isValid()) {
804 return hasKeyboardSpy.wait();
807void render(KWayland::Client::Surface *surface,
const QSize &size,
const QColor &color,
const QImage::Format &
format)
814void render(KWayland::Client::Surface *surface,
const QImage &img)
816 surface->attachBuffer(s_waylandConnection.shm->createBuffer(img));
817 surface->damage(QRect(QPoint(0, 0), img.size()));
818 surface->commit(KWayland::Client::Surface::CommitFlag::None);
824 if (!windowAddedSpy.isValid()) {
827 if (!windowAddedSpy.wait(timeout)) {
830 return windowAddedSpy.first().first().value<
Window *>();
843 if (!windowAddedSpy.isValid()) {
848 if (!windowAddedSpy.wait(timeout)) {
851 return windowAddedSpy.first().first().value<
Window *>();
856 if (s_waylandConnection.connection) {
857 s_waylandConnection.connection->flush();
868 static const wl_callback_listener listener = {
869 .done = [](
void *data, wl_callback *callback, uint32_t callback_data) {
871 Q_EMIT syncPoint->
done();
875 m_callback = wl_display_sync(
connection->display());
876 eventQueue->addProxy(m_callback);
877 wl_callback_add_listener(m_callback, &listener,
this);
882 wl_callback_destroy(m_callback);
889 wl_callback *m_callback;
894 WaylandSyncPoint syncPoint(s_waylandConnection.connection, s_waylandConnection.queue);
896 return doneSpy.wait();
901 if (!s_waylandConnection.compositor) {
904 std::unique_ptr<KWayland::Client::Surface> s{s_waylandConnection.compositor->createSurface()};
905 return s->isValid() ? std::move(s) :
nullptr;
908KWayland::Client::SubSurface *
createSubSurface(KWayland::Client::Surface *surface, KWayland::Client::Surface *parentSurface, QObject *parent)
910 if (!s_waylandConnection.subCompositor) {
913 auto s = s_waylandConnection.subCompositor->createSubSurface(surface, parentSurface, parent);
925 qWarning() <<
"Could not create a layer surface because the layer shell global is not bound";
929 struct ::wl_output *nativeOutput =
nullptr;
931 nativeOutput = *output;
935 shellSurface->init(shell->get_layer_surface(*surface, nativeOutput, layer, scope));
942 if (!s_waylandConnection.inputPanelV1) {
943 qWarning() <<
"Unable to create the input panel surface. The interface input_panel global is not bound";
946 QtWayland::zwp_input_panel_surface_v1 *s =
new QtWayland::zwp_input_panel_surface_v1(s_waylandConnection.inputPanelV1->get_input_panel_surface(*surface));
948 if (!s->isInitialized()) {
955 s->set_toplevel(output->output(), QtWayland::zwp_input_panel_surface_v1::position_center_bottom);
958 s->set_overlay_panel();
967 if (!s_waylandConnection.fractionalScaleManagerV1) {
968 qWarning() <<
"Unable to create fractional scale surface. The global is not bound";
972 scale->init(s_waylandConnection.fractionalScaleManagerV1->get_fractional_scale(*surface));
977static void waitForConfigured(
XdgSurface *shellSurface)
981 shellSurface->surface()->commit(KWayland::Client::Surface::CommitFlag::None);
982 QVERIFY(surfaceConfigureRequestedSpy.wait());
984 shellSurface->ack_configure(surfaceConfigureRequestedSpy.last().first().toUInt());
994 XdgShell *shell = s_waylandConnection.xdgShell;
997 qWarning() <<
"Could not create an xdg_toplevel surface because xdg_wm_base global is not bound";
1005 waitForConfigured(xdgSurface);
1013 XdgShell *shell = s_waylandConnection.xdgShell;
1016 qWarning() <<
"Could not create an xdg_positioner object because xdg_wm_base global is not bound";
1026 XdgShell *shell = s_waylandConnection.xdgShell;
1029 qWarning() <<
"Could not create an xdg_popup surface because xdg_wm_base global is not bound";
1034 XdgPopup *xdgPopup =
new XdgPopup(xdgSurface, parentSurface, positioner, parent);
1037 waitForConfigured(xdgSurface);
1048 qWarning() <<
"Could not create an xdg_toplevel_decoration_v1 because xdg_decoration_manager_v1 global is not bound";
1059 qWarning() <<
"Could not create an idle_inhibitor_v1 because idle_inhibit_manager_v1 global is not bound";
1070 qWarning() <<
"Could not create an kde_auto_hide_screen_edge_v1 because kde_screen_edge_manager_v1 global is not bound";
1081 qWarning() <<
"Could not create a wp_cursor_shape_device_v1 because wp_cursor_shape_manager_v1 global is not bound";
1091 if (!closedSpy.isValid()) {
1094 return closedSpy.wait();
1097#if KWIN_BUILD_SCREENLOCKER
1103 QSignalSpy lockStateChangedSpy(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged);
1104 if (!lockStateChangedSpy.isValid()) {
1107 ScreenLocker::KSldApp::self()->lock(ScreenLocker::EstablishLock::Immediate);
1108 if (lockStateChangedSpy.count() != 1) {
1114 if (!kwinApp()->screenLockerWatcher()->isLocked()) {
1116 if (!lockedSpy.isValid()) {
1119 if (!lockedSpy.wait()) {
1122 if (!kwinApp()->screenLockerWatcher()->isLocked()) {
1131 QSignalSpy lockStateChangedSpy(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged);
1132 if (!lockStateChangedSpy.isValid()) {
1135 using namespace ScreenLocker;
1136 const auto children = KSldApp::self()->children();
1137 for (
auto it = children.begin(); it != children.end(); ++it) {
1138 if (qstrcmp((*it)->metaObject()->className(),
"LogindIntegration") != 0) {
1141 QMetaObject::invokeMethod(*it,
"requestUnlock");
1145 lockStateChangedSpy.wait();
1150 if (kwinApp()->screenLockerWatcher()->isLocked()) {
1152 if (!lockedSpy.isValid()) {
1155 if (!lockedSpy.wait()) {
1158 if (kwinApp()->screenLockerWatcher()->isLocked()) {
1168 const int deviceCount = drmGetDevices2(0,
nullptr, 0);
1169 if (deviceCount <= 0) {
1173 QList<drmDevice *> devices(deviceCount);
1174 if (drmGetDevices2(0, devices.data(), devices.size()) < 0) {
1177 auto deviceCleanup = qScopeGuard([&devices]() {
1178 drmFreeDevices(devices.data(), devices.size());
1181 return std::any_of(devices.constBegin(), devices.constEnd(), [](drmDevice *device) {
1182 return device->available_nodes & (1 << DRM_NODE_RENDER);
1188 xcb_disconnect(pointer);
1196 QFuture<xcb_connection_t *> future = QtConcurrent::run([]() {
1197 return xcb_connect(
nullptr,
nullptr);
1199 watcher.setFuture(future);
1218 ,
QtWayland::kde_output_configuration_v2()
1233 :
QtWayland::kde_output_device_mode_v2(object)
1239 kde_output_device_mode_v2_destroy(
object());
1244 m_size = QSize(width, height);
1249 m_refreshRate = refresh;
1264 return m_refreshRate;
1279 return m_size == other.m_size && m_refreshRate == other.m_refreshRate && m_preferred == other.m_preferred;
1284 auto mode = QtWayland::kde_output_device_mode_v2::fromObject(
object);
1290 , kde_output_device_v2()
1297 qDeleteAll(m_modes);
1299 kde_output_device_v2_destroy(
object());
1304 int32_t physical_width,
1305 int32_t physical_height,
1307 const QString &make,
1308 const QString &model,
1311 m_pos = QPoint(x, y);
1312 m_physicalSize = QSize(physical_width, physical_height);
1313 m_subpixel = subpixel;
1314 m_manufacturer = make;
1316 m_transform = transform;
1323 if (*m == *m_mode) {
1338 m_modes.removeOne(m);
1340 if (!m_modes.isEmpty()) {
1341 m_mode = m_modes.first();
1344 qFatal(
"KWaylandBackend: no output modes available anymore, this seems like a compositor bug");
1354 return QString::number(m_modes.indexOf(m_mode));
1359 return m_modes.at(
modeId);
1362QString WaylandOutputDeviceV2::modeName(
const WaylandOutputDeviceV2Mode *m)
const
1364 return QString::number(m->size().width()) + QLatin1Char(
'x') + QString::number(m->size().height()) + QLatin1Char(
'@')
1365 + QString::number(qRound(m->refreshRate() / 1000.0));
1370 return QStringLiteral(
"%1 %2").arg(m_manufacturer, m_model);
1375 dbg <<
"WaylandOutput(Id:" << output->
id() <<
", Name:" << QString(output->
manufacturer() + QLatin1Char(
' ') + output->
model()) <<
")";
1386 m_factor = wl_fixed_to_double(factor);
1391 m_edid = QByteArray::fromBase64(
edid.toUtf8());
1409 m_serialNumber = serialNumber;
1429 m_vrr_policy = vrr_policy;
1434 m_rgbRange = rgb_range;
1459 return m_manufacturer;
1474 return m_mode->
size();
1484 return m_vrr_policy;
1616 Q_EMIT virtualPointer->pointerFrame(virtualPointer);
1623 Q_EMIT virtualPointer->pointerFrame(virtualPointer);
1630 Q_EMIT virtualPointer->pointerFrame(virtualPointer);
1637 Q_EMIT virtualPointer->pointerFrame(virtualPointer);
1643 Q_EMIT virtualPointer->pointerMotionAbsolute(position, std::chrono::milliseconds(time), virtualPointer);
1644 Q_EMIT virtualPointer->pointerFrame(virtualPointer);
1650 Q_EMIT virtualPointer->pointerMotion(delta, delta, std::chrono::milliseconds(time), virtualPointer);
1651 Q_EMIT virtualPointer->pointerFrame(virtualPointer);
1657 Q_EMIT virtualTouch->touchCanceled(virtualTouch);
1663 Q_EMIT virtualTouch->touchDown(
id, pos, std::chrono::milliseconds(time), virtualTouch);
1669 Q_EMIT virtualTouch->touchMotion(
id, pos, std::chrono::milliseconds(time), virtualTouch);
1675 Q_EMIT virtualTouch->touchUp(
id, std::chrono::milliseconds(time), virtualTouch);
1680#include "test_helpers.moc"
ClientConnection * createClient(int fd)
~AutoHideScreenEdgeV1() override
AutoHideScreenEdgeV1(ScreenEdgeManagerV1 *manager, KWayland::Client::Surface *surface, uint32_t border)
~CursorShapeDeviceV1() override
CursorShapeDeviceV1(CursorShapeManagerV1 *manager, KWayland::Client::Pointer *pointer)
~CursorShapeManagerV1() override
~IdleInhibitManagerV1() override
~IdleInhibitorV1() 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)
~LayerSurfaceV1() override
~ScreenEdgeManagerV1() override
~SecurityContextManagerV1() override
WaylandOutputConfigurationV2(struct ::kde_output_configuration_v2 *object)
void kde_output_configuration_v2_failed() override
void kde_output_configuration_v2_applied() override
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
QPoint globalPosition() const
QString manufacturer() const
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
uint32_t overscan() const
void kde_output_device_v2_enabled(int32_t enabled) override
uint32_t capabilities() const
void kde_output_device_v2_edid(const QString &raw) override
~WaylandOutputDeviceV2() override
WaylandOutputDeviceV2(int id)
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
uint32_t rgbRange() const
void kde_output_device_v2_done() override
void kde_output_device_v2_current_mode(struct ::kde_output_device_mode_v2 *mode) override
uint32_t vrrPolicy() const
~WaylandOutputDeviceV2Mode() override
WaylandOutputDeviceV2Mode(struct ::kde_output_device_mode_v2 *object)
void kde_output_device_mode_v2_preferred() override
bool operator==(const WaylandOutputDeviceV2Mode &other) const
void kde_output_device_mode_v2_refresh(int32_t refresh) override
void kde_output_device_mode_v2_removed() 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()
~WaylandSyncPoint() override
WaylandSyncPoint(KWayland::Client::ConnectionThread *connection, KWayland::Client::EventQueue *eventQueue)
~XdgDecorationManagerV1() override
~XdgPositioner() 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
~XdgToplevelDecorationV1() 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)
Display * display() const
SurfaceInterface * surface() const
void windowAdded(KWin::Window *)
WaylandOutputManagementV2 * outputManagementV2
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()
KWayland::Client::Seat * seat
KWayland::Client::ShmPool * shm
KWayland::Client::EventQueue * queue
SecurityContextManagerV1 * securityContextManagerV1
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()
QtWayland::zwp_input_panel_v1 * inputPanelV1
QList< WaylandOutputDeviceV2 * > waylandOutputDevicesV2()
bool setupWaylandConnection(AdditionalWaylandInterfaces flags=AdditionalWaylandInterfaces())
void touchMotion(qint32 id, const QPointF &pos, quint32 time)
KWayland::Client::PlasmaWindowManagement * waylandWindowManagement()
KWayland::Client::PlasmaWindowManagement * windowManagement
KWayland::Client::Compositor * waylandCompositor()
KWayland::Client::ShadowManager * shadowManager
FractionalScaleManagerV1 * fractionalScaleManagerV1
ScreencastingV1 * screencastingV1
KWayland::Client::SubCompositor * waylandSubCompositor()
MockInputMethod * inputMethodV1
KWayland::Client::PointerConstraints * waylandPointerConstraints()
void render(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format=QImage::Format_ARGB32_Premultiplied)
KWayland::Client::PlasmaShell * plasmaShell
KWayland::Client::SubCompositor * subCompositor
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)
KWayland::Client::TextInputManager * textInputManager
MockInputMethod * inputMethod()
KWayland::Client::AppMenuManager * appMenu
QList< KWayland::Client::Output * > waylandOutputs()
KWayland::Client::Surface * inputPanelSurface()
void pointerButtonPressed(quint32 button, quint32 time)
KWayland::Client::ShadowManager * waylandShadowManager()
XcbConnectionPtr createX11Connection()
QList< KWayland::Client::Output * > outputs
void pointerMotion(const QPointF &position, quint32 time)
CursorShapeManagerV1 * cursorShapeManagerV1
bool renderNodeAvailable()
QList< WaylandOutputDeviceV2 * > outputDevicesV2
KWayland::Client::PointerConstraints * pointerConstraints
@ SecurityContextManagerV1
@ FractionalScaleManagerV1
std::unique_ptr< KWayland::Client::Surface > createSurface()
KWayland::Client::ShmPool * waylandShmPool()
void pointerMotionRelative(const QPointF &delta, quint32 time)
LayerShellV1 * layerShellV1
XdgToplevel * createXdgToplevelSurface(KWayland::Client::Surface *surface, QObject *parent=nullptr)
IdleInhibitManagerV1 * idleInhibitManagerV1
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 waitForWaylandPointer()
KWayland::Client::ConnectionThread * waylandConnection()
QtWayland::zwp_input_method_context_v1 * inputMethodContextV1
KWayland::Client::TextInputManager * waylandTextInputManager()
void pointerButtonReleased(quint32 button, quint32 time)
void touchUp(qint32 id, quint32 time)
CursorShapeDeviceV1 * createCursorShapeDeviceV1(KWayland::Client::Pointer *pointer)
ScreenEdgeManagerV1 * screenEdgeManagerV1
KWayland::Client::ConnectionThread * connection
QDebug operator<<(QDebug dbg, const WaylandOutputDeviceV2 *output)
void flushWaylandConnection()
KWayland::Client::PlasmaShell * waylandPlasmaShell()
std::unique_ptr< xcb_connection_t, XcbConnectionDeleter > XcbConnectionPtr
KWayland::Client::Compositor * compositor
bool waitForWindowClosed(Window *window)
TextInputManagerV3 * textInputManagerV3
KWayland::Client::Output * waylandOutput(const QString &name)
FakeInput * waylandFakeInput()
XdgDecorationManagerV1 * xdgDecorationManagerV1
WaylandServer * waylandServer()
void operator()(xcb_connection_t *pointer)