| 1 |
// SPDX-FileCopyrightText: 2022 Uniontech Software Technology Co.,Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 |
|
| 5 |
#ifndef DWaylandShellManager_H |
| 6 |
#define DWaylandShellManager_H |
| 7 |
|
| 8 |
#include "vtablehook.h" |
| 9 |
|
| 10 |
#define private public |
| 11 |
#include "QtWaylandClient/private/qwaylandintegration_p.h" |
| 12 |
#include "QtWaylandClient/private/qwaylandshellintegrationplugin_p.h" |
| 13 |
#include "QtWaylandClient/private/qwaylandshellintegration_p.h" |
| 14 |
#include "QtWaylandClient/private/qwaylandshellsurface_p.h" |
| 15 |
#include "QtWaylandClient/private/qwaylandwindow_p.h" |
| 16 |
#include "QtWaylandClient/private/qwaylandcursor_p.h" |
| 17 |
#include "QtWaylandClient/private/qwaylandscreen_p.h" |
| 18 |
#undef private |
| 19 |
|
| 20 |
#ifndef D_DEEPIN_IS_DWAYLAND |
| 21 |
#include <KWayland/Client/registry.h> |
| 22 |
#include <KWayland/Client/plasmashell.h> |
| 23 |
#include <KWayland/Client/server_decoration.h> |
| 24 |
#include <KWayland/Client/ddeshell.h> |
| 25 |
#include <KWayland/Client/ddeseat.h> |
| 26 |
#include <KWayland/Client/ddekeyboard.h> |
| 27 |
#include <KWayland/Client/strut.h> |
| 28 |
#include <KWayland/Client/fakeinput.h> |
| 29 |
#include <KWayland/Client/compositor.h> |
| 30 |
#include <KWayland/Client/blur.h> |
| 31 |
#include <KWayland/Client/region.h> |
| 32 |
#include <KWayland/Client/surface.h> |
| 33 |
#include <KWayland/Client/plasmawindowmanagement.h> |
| 34 |
#else |
| 35 |
#include <DWayland/Client/registry.h> |
| 36 |
#include <DWayland/Client/plasmashell.h> |
| 37 |
#include <DWayland/Client/server_decoration.h> |
| 38 |
#include <DWayland/Client/ddeshell.h> |
| 39 |
#include <DWayland/Client/ddeseat.h> |
| 40 |
#include <DWayland/Client/ddekeyboard.h> |
| 41 |
#include <DWayland/Client/strut.h> |
| 42 |
#include <DWayland/Client/fakeinput.h> |
| 43 |
#include <DWayland/Client/compositor.h> |
| 44 |
#include <DWayland/Client/blur.h> |
| 45 |
#include <DWayland/Client/region.h> |
| 46 |
#include <DWayland/Client/surface.h> |
| 47 |
#include <DWayland/Client/plasmawindowmanagement.h> |
| 48 |
#endif |
| 49 |
|
| 50 |
#include <QGuiApplication> |
| 51 |
#include <QPointer> |
| 52 |
#include <QDebug> |
| 53 |
#include <qpa/qplatformnativeinterface.h> |
| 54 |
#include <private/qguiapplication_p.h> |
| 55 |
#include <private/qwidgetwindow_p.h> |
| 56 |
|
| 57 |
DPP_USE_NAMESPACE |
| 58 |
using namespace KWayland::Client; |
| 59 |
|
| 60 |
namespace QtWaylandClient { |
| 61 |
|
| 62 |
class DWaylandShellManager |
| 63 |
{ |
| 64 |
DWaylandShellManager(); |
| 65 |
~DWaylandShellManager(); |
| 66 |
Registry *m_registry = nullptr; |
| 67 |
public: |
| 68 |
static DWaylandShellManager *instance() { |
| 69 |
static DWaylandShellManager manager; |
| 70 |
return &manager; |
| 71 |
} |
| 72 |
static Registry *registry() { |
| 73 |
return instance()->m_registry; |
| 74 |
} |
| 75 |
|
| 76 |
static void sendProperty(QWaylandShellSurface *self, const QString &name, const QVariant &value); |
| 77 |
static void requestActivateWindow(QPlatformWindow *self); |
| 78 |
static bool disableClientDecorations(QWaylandShellSurface *surface); |
| 79 |
static QMargins frameMargins(QPlatformWindow *self); |
| 80 |
static void setWindowFlags(QPlatformWindow *self, Qt::WindowFlags flags); |
| 81 |
static void createServerDecoration(QWaylandShellSurface *shellSurface); |
| 82 |
static void setGeometry(QPlatformWindow *self, const QRect &rect); |
| 83 |
static void pointerEvent(const QPointF &pointF, QEvent::Type type); |
| 84 |
static QWaylandShellSurface *createShellSurface(QWaylandShellIntegration *self, QWaylandWindow *window); |
| 85 |
static void createKWaylandShell(quint32 name, quint32 version); |
| 86 |
static void createKWaylandSSD(quint32 name, quint32 version); |
| 87 |
static void createDDEShell(quint32 name, quint32 version); |
| 88 |
static void createDDESeat(quint32 name, quint32 version); |
| 89 |
static void createStrut(quint32 name, quint32 version); |
| 90 |
static void createDDEPointer(); |
| 91 |
static void createDDEKeyboard(); |
| 92 |
static void createDDEFakeInput(); |
| 93 |
static void createBlurManager(quint32 name, quint32 version); |
| 94 |
static void createCompositor(quint32 name, quint32 version); |
| 95 |
static void createSurface(); |
| 96 |
static void createPlasmaWindowManagement(KWayland::Client::Registry *registry, quint32 name, quint32 version); |
| 97 |
static void handleGeometryChange(QWaylandShellSurface *shellSurface); |
| 98 |
static void handleWindowStateChanged(QWaylandShellSurface *shellSurface); |
| 99 |
static void setWindowStaysOnTop(QWaylandShellSurface *surface, const bool state); |
| 100 |
static void setDockStrut(QWaylandShellSurface *surface, const QVariant var); |
| 101 |
static void setCursorPoint(QPointF pos); |
| 102 |
static void setEnableBlurWidow(QWaylandWindow *wlWindow, const QVariant &value); |
| 103 |
static void updateWindowBlurAreasForWM(QWaylandWindow *wlWindow, const QString &name, const QVariant &value); |
| 104 |
static void setDockAppItemMinimizedGeometry(QWaylandShellSurface *surface, const QVariant var); |
| 105 |
|
| 106 |
static void onShellSurfaceCreated(QWaylandShellSurface *shellSurface); |
| 107 |
private: |
| 108 |
// 用于记录设置过以_DWAYALND_开头的属性,当kwyalnd_shell对象创建以后要使这些属性生效 |
| 109 |
static QList<QPointer<QWaylandWindow>> send_property_window_list; |
| 110 |
}; |
| 111 |
} |
| 112 |
|
| 113 |
#endif // DWaylandShellManager_H |