1 /*  This file is part of the KDE libraries
2     SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
3 
4     SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #ifndef KWAYLANDINTEGRATION_H
7 #define KWAYLANDINTEGRATION_H
8 
9 #include <QHash>
10 #include <QObject>
11 
12 class QWindow;
13 
14 namespace KWayland
15 {
16 namespace Client
17 {
18 class ServerSideDecorationPaletteManager;
19 class AppMenuManager;
20 class Registry;
21 }
22 }
23 
24 class KWaylandIntegration : public QObject
25 {
26     Q_OBJECT
27 public:
28     explicit KWaylandIntegration();
29     ~KWaylandIntegration() override;
30     void init();
31 
32     void setAppMenu(QWindow *window, const QString &serviceName, const QString &objectPath);
33     void setPalette(QWindow *window, const QString &paletteName);
34 
35     bool eventFilter(QObject *watched, QEvent *event) override;
36 
37 private:
38     void shellSurfaceCreated(QWindow *w);
39     void shellSurfaceDestroyed(QWindow *w);
40 
41     void installColorScheme(QWindow *w);
42     KWayland::Client::AppMenuManager *m_appMenuManager = nullptr;
43     KWayland::Client::ServerSideDecorationPaletteManager *m_paletteManager = nullptr;
44     KWayland::Client::Registry *m_registry = nullptr;
45 
46     struct WindowInfo {
47         QString appMenuServiceName;
48         QString appMenuObjectPath;
49     };
50     QHash<QWindow *, WindowInfo> m_windowInfo;
51 };
52 
53 #endif
54