Changeset View
Changeset View
Standalone View
Standalone View
src/waylandintegration.cpp
Show All 35 Lines | |||||
36 | 36 | | |||
37 | // KWayland | 37 | // KWayland | ||
38 | #include <KWayland/Client/connection_thread.h> | 38 | #include <KWayland/Client/connection_thread.h> | ||
39 | #include <KWayland/Client/event_queue.h> | 39 | #include <KWayland/Client/event_queue.h> | ||
40 | #include <KWayland/Client/fakeinput.h> | 40 | #include <KWayland/Client/fakeinput.h> | ||
41 | #include <KWayland/Client/registry.h> | 41 | #include <KWayland/Client/registry.h> | ||
42 | #include <KWayland/Client/output.h> | 42 | #include <KWayland/Client/output.h> | ||
43 | #include <KWayland/Client/remote_access.h> | 43 | #include <KWayland/Client/remote_access.h> | ||
44 | #include <KWayland/Client/plasmawindowmanagement.h> | ||||
44 | 45 | | |||
45 | // system | 46 | // system | ||
46 | #include <fcntl.h> | 47 | #include <fcntl.h> | ||
47 | #include <unistd.h> | 48 | #include <unistd.h> | ||
48 | 49 | | |||
49 | Q_LOGGING_CATEGORY(XdgDesktopPortalKdeWaylandIntegration, "xdp-kde-wayland-integration") | 50 | Q_LOGGING_CATEGORY(XdgDesktopPortalKdeWaylandIntegration, "xdp-kde-wayland-integration") | ||
50 | 51 | | |||
51 | Q_GLOBAL_STATIC(WaylandIntegration::WaylandIntegrationPrivate, globalWaylandIntegration) | 52 | Q_GLOBAL_STATIC(WaylandIntegration::WaylandIntegrationPrivate, globalWaylandIntegration) | ||
52 | 53 | | |||
53 | void WaylandIntegration::authenticate() | 54 | void WaylandIntegration::authenticate() | ||
54 | { | 55 | { | ||
55 | globalWaylandIntegration->authenticate(); | 56 | globalWaylandIntegration->authenticate(); | ||
56 | } | 57 | } | ||
57 | 58 | | |||
58 | void WaylandIntegration::init() | 59 | void WaylandIntegration::init() | ||
59 | { | 60 | { | ||
61 | #if SCREENCAST_ENABLED | ||||
60 | globalWaylandIntegration->initDrm(); | 62 | globalWaylandIntegration->initDrm(); | ||
63 | #endif | ||||
61 | globalWaylandIntegration->initWayland(); | 64 | globalWaylandIntegration->initWayland(); | ||
62 | } | 65 | } | ||
63 | 66 | | |||
64 | bool WaylandIntegration::isEGLInitialized() | 67 | bool WaylandIntegration::isEGLInitialized() | ||
65 | { | 68 | { | ||
66 | return globalWaylandIntegration->isEGLInitialized(); | 69 | return globalWaylandIntegration->isEGLInitialized(); | ||
67 | } | 70 | } | ||
68 | 71 | | |||
Show All 37 Lines | 108 | { | |||
106 | globalWaylandIntegration->requestPointerMotionAbsolute(pos); | 109 | globalWaylandIntegration->requestPointerMotionAbsolute(pos); | ||
107 | } | 110 | } | ||
108 | 111 | | |||
109 | void WaylandIntegration::requestPointerAxisDiscrete(Qt::Orientation axis, qreal delta) | 112 | void WaylandIntegration::requestPointerAxisDiscrete(Qt::Orientation axis, qreal delta) | ||
110 | { | 113 | { | ||
111 | globalWaylandIntegration->requestPointerAxisDiscrete(axis, delta); | 114 | globalWaylandIntegration->requestPointerAxisDiscrete(axis, delta); | ||
112 | } | 115 | } | ||
113 | 116 | | |||
117 | KWayland::Client::PlasmaWindowManagement * WaylandIntegration::plasmaWindowManagement() | ||||
118 | { | ||||
119 | return globalWaylandIntegration->plasmaWindowManagement(); | ||||
120 | } | ||||
121 | | ||||
114 | QMap<quint32, WaylandIntegration::WaylandOutput> WaylandIntegration::screens() | 122 | QMap<quint32, WaylandIntegration::WaylandOutput> WaylandIntegration::screens() | ||
115 | { | 123 | { | ||
116 | return globalWaylandIntegration->screens(); | 124 | return globalWaylandIntegration->screens(); | ||
117 | } | 125 | } | ||
118 | 126 | | |||
119 | QVariant WaylandIntegration::streams() | 127 | QVariant WaylandIntegration::streams() | ||
120 | { | 128 | { | ||
121 | return globalWaylandIntegration->streams(); | 129 | return globalWaylandIntegration->streams(); | ||
▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Line(s) | 380 | { | |||
375 | } | 383 | } | ||
376 | } | 384 | } | ||
377 | 385 | | |||
378 | QMap<quint32, WaylandIntegration::WaylandOutput> WaylandIntegration::WaylandIntegrationPrivate::screens() | 386 | QMap<quint32, WaylandIntegration::WaylandOutput> WaylandIntegration::WaylandIntegrationPrivate::screens() | ||
379 | { | 387 | { | ||
380 | return m_outputMap; | 388 | return m_outputMap; | ||
381 | } | 389 | } | ||
382 | 390 | | |||
391 | KWayland::Client::PlasmaWindowManagement * WaylandIntegration::WaylandIntegrationPrivate::plasmaWindowManagement() | ||||
392 | { | ||||
393 | return m_windowManagement; | ||||
394 | } | ||||
395 | | ||||
383 | QVariant WaylandIntegration::WaylandIntegrationPrivate::streams() | 396 | QVariant WaylandIntegration::WaylandIntegrationPrivate::streams() | ||
384 | { | 397 | { | ||
385 | Stream stream; | 398 | Stream stream; | ||
386 | stream.nodeId = m_stream->nodeId(); | 399 | stream.nodeId = m_stream->nodeId(); | ||
387 | stream.map = QVariantMap({{QLatin1String("size"), m_outputMap.value(m_output).resolution()}}); | 400 | stream.map = QVariantMap({{QLatin1String("size"), m_outputMap.value(m_output).resolution()}}); | ||
388 | return QVariant::fromValue<WaylandIntegrationPrivate::Streams>({stream}); | 401 | return QVariant::fromValue<WaylandIntegrationPrivate::Streams>({stream}); | ||
389 | } | 402 | } | ||
390 | 403 | | |||
▲ Show 20 Lines • Show All 240 Lines • ▼ Show 20 Line(s) | |||||
631 | 644 | | |||
632 | void WaylandIntegration::WaylandIntegrationPrivate::setupRegistry() | 645 | void WaylandIntegration::WaylandIntegrationPrivate::setupRegistry() | ||
633 | { | 646 | { | ||
634 | m_queue = new KWayland::Client::EventQueue(this); | 647 | m_queue = new KWayland::Client::EventQueue(this); | ||
635 | m_queue->setup(m_connection); | 648 | m_queue->setup(m_connection); | ||
636 | 649 | | |||
637 | m_registry = new KWayland::Client::Registry(this); | 650 | m_registry = new KWayland::Client::Registry(this); | ||
638 | 651 | | |||
652 | #if SCREENCAST_ENABLED | ||||
639 | connect(m_registry, &KWayland::Client::Registry::fakeInputAnnounced, this, [this] (quint32 name, quint32 version) { | 653 | connect(m_registry, &KWayland::Client::Registry::fakeInputAnnounced, this, [this] (quint32 name, quint32 version) { | ||
640 | m_fakeInput = m_registry->createFakeInput(name, version, this); | 654 | m_fakeInput = m_registry->createFakeInput(name, version, this); | ||
641 | }); | 655 | }); | ||
642 | connect(m_registry, &KWayland::Client::Registry::outputAnnounced, this, &WaylandIntegrationPrivate::addOutput); | 656 | connect(m_registry, &KWayland::Client::Registry::outputAnnounced, this, &WaylandIntegrationPrivate::addOutput); | ||
643 | connect(m_registry, &KWayland::Client::Registry::outputRemoved, this, &WaylandIntegrationPrivate::removeOutput); | 657 | connect(m_registry, &KWayland::Client::Registry::outputRemoved, this, &WaylandIntegrationPrivate::removeOutput); | ||
658 | #endif | ||||
659 | connect(m_registry, &KWayland::Client::Registry::plasmaWindowManagementAnnounced, this, [this] (quint32 name, quint32 version) { | ||||
660 | m_windowManagement = m_registry->createPlasmaWindowManagement(name, version, this); | ||||
661 | Q_EMIT waylandIntegration()->plasmaWindowManagementInitialized(); | ||||
662 | }); | ||||
644 | 663 | | |||
645 | connect(m_registry, &KWayland::Client::Registry::interfacesAnnounced, this, [this] { | 664 | connect(m_registry, &KWayland::Client::Registry::interfacesAnnounced, this, [this] { | ||
646 | m_registryInitialized = true; | 665 | m_registryInitialized = true; | ||
647 | qCDebug(XdgDesktopPortalKdeWaylandIntegration) << "Registry initialized"; | 666 | qCDebug(XdgDesktopPortalKdeWaylandIntegration) << "Registry initialized"; | ||
648 | }); | 667 | }); | ||
649 | 668 | | |||
650 | m_registry->create(m_connection); | 669 | m_registry->create(m_connection); | ||
651 | m_registry->setEventQueue(m_queue); | 670 | m_registry->setEventQueue(m_queue); | ||
652 | m_registry->setup(); | 671 | m_registry->setup(); | ||
653 | } | 672 | } |