Krita Source Code Documentation
Loading...
Searching...
No Matches
KisWaylandRegistry.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Luna Lovecraft <ciubix8514@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
8#include <qguiapplication.h>
9
10Q_GLOBAL_STATIC(KisWaylandRegistry, s_waylandRegistry)
11
13{
14 QHash<uint32_t, std::pair<QString, uint32_t>> globals;
15 bool initialized = false;
16};
17
22
26
27void KisWaylandRegistry::registry_global(uint32_t name, const QString &interface, uint32_t version)
28{
29 d->globals.insert(name, std::pair<QString, uint32_t>(interface, version));
30}
31
32bool KisWaylandRegistry::globalExists(const QString& interface)
33{
34 //Check if the interface is explicitly disabled
35 static QStringList interfaceBlacklist = qEnvironmentVariable("QT_WAYLAND_DISABLED_INTERFACES").split(u',');
36
37 if (interfaceBlacklist.contains(interface)) {
38 return false;
39 }
40
41 Q_FOREACH(auto global, d->globals.values()) {
42 if (global.first == interface)
43 return true;
44 }
45
46 return false;
47}
48
50{
51 d->globals.remove(name);
52}
53
55{
56 if (!s_waylandRegistry->d->initialized) {
57 KisWaylandRegistry *registry = s_waylandRegistry;
58 registry->d->initialized = true;
59
60 auto waylandApp = qGuiApp->nativeInterface<QNativeInterface::QWaylandApplication>();
61 auto display = waylandApp->display();
62 auto regisry = ::wl_display_get_registry(display);
63 registry->init(regisry);
64
65 //Wait for the compositor to populate the registry
66 ::wl_display_roundtrip(display);
67 }
68
69 return s_waylandRegistry;
70}
qreal u
Q_GLOBAL_STATIC(KisStoragePluginRegistry, s_instance)
Wayland registry for tracking wayland globals.
QScopedPointer< Private > d
static KisWaylandRegistry * getOrCreate()
void registry_global_remove(uint32_t name) override
bool globalExists(const QString &interface)
void registry_global(uint32_t name, const QString &interface, uint32_t version) override
QHash< uint32_t, std::pair< QString, uint32_t > > globals