| 1 | // Copyright (C) 2017 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QWAYLANDWLSHELL_P_H |
| 5 | #define QWAYLANDWLSHELL_P_H |
| 6 | |
| 7 | #include <QtWaylandCompositor/qtwaylandcompositorglobal.h> |
| 8 | #include <QtWaylandCompositor/qwaylandsurface.h> |
| 9 | #include <QtWaylandCompositor/private/qwaylandshellsurface_p.h> |
| 10 | #include <QtWaylandCompositor/private/qwaylandshell_p.h> |
| 11 | #include <QtWaylandCompositor/QWaylandWlShellSurface> |
| 12 | #include <QtWaylandCompositor/QWaylandSeat> |
| 13 | |
| 14 | #include <wayland-server-core.h> |
| 15 | #include <QHash> |
| 16 | #include <QPoint> |
| 17 | #include <QSet> |
| 18 | |
| 19 | #include <QtWaylandCompositor/private/qwayland-server-wayland.h> |
| 20 | |
| 21 | #include <QtCore/qpointer.h> |
| 22 | |
| 23 | // |
| 24 | // W A R N I N G |
| 25 | // ------------- |
| 26 | // |
| 27 | // This file is not part of the Qt API. It exists purely as an |
| 28 | // implementation detail. This header file may change from version to |
| 29 | // version without notice, or even be removed. |
| 30 | // |
| 31 | // We mean it. |
| 32 | // |
| 33 | |
| 34 | QT_BEGIN_NAMESPACE |
| 35 | |
| 36 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandWlShellPrivate |
| 37 | : public QWaylandShellPrivate |
| 38 | , public QtWaylandServer::wl_shell |
| 39 | { |
| 40 | Q_DECLARE_PUBLIC(QWaylandWlShell) |
| 41 | public: |
| 42 | QWaylandWlShellPrivate(); |
| 43 | |
| 44 | void unregisterShellSurface(QWaylandWlShellSurface *shellSurface); |
| 45 | |
| 46 | static QWaylandWlShellPrivate *get(QWaylandWlShell *shell) { return shell->d_func(); } |
| 47 | |
| 48 | protected: |
| 49 | void shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) override; |
| 50 | |
| 51 | QList<QWaylandWlShellSurface *> m_shellSurfaces; |
| 52 | }; |
| 53 | |
| 54 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandWlShellSurfacePrivate |
| 55 | : public QWaylandShellSurfacePrivate |
| 56 | , public QtWaylandServer::wl_shell_surface |
| 57 | { |
| 58 | Q_DECLARE_PUBLIC(QWaylandWlShellSurface) |
| 59 | public: |
| 60 | QWaylandWlShellSurfacePrivate(); |
| 61 | ~QWaylandWlShellSurfacePrivate() override; |
| 62 | |
| 63 | static QWaylandWlShellSurfacePrivate *get(QWaylandWlShellSurface *surface) { return surface->d_func(); } |
| 64 | |
| 65 | void ping(uint32_t serial); |
| 66 | |
| 67 | void setWindowType(Qt::WindowType windowType); |
| 68 | |
| 69 | private: |
| 70 | QWaylandWlShell *m_shell = nullptr; |
| 71 | QPointer<QWaylandSurface> m_surface; |
| 72 | |
| 73 | QSet<uint32_t> m_pings; |
| 74 | |
| 75 | QString m_title; |
| 76 | QString m_className; |
| 77 | Qt::WindowType m_windowType = Qt::WindowType::Window; |
| 78 | |
| 79 | void shell_surface_destroy_resource(Resource *resource) override; |
| 80 | |
| 81 | void shell_surface_move(Resource *resource, |
| 82 | struct wl_resource *input_device_super, |
| 83 | uint32_t time) override; |
| 84 | void shell_surface_resize(Resource *resource, |
| 85 | struct wl_resource *input_device, |
| 86 | uint32_t time, |
| 87 | uint32_t edges) override; |
| 88 | void shell_surface_set_toplevel(Resource *resource) override; |
| 89 | void shell_surface_set_transient(Resource *resource, |
| 90 | struct wl_resource *parent_surface_resource, |
| 91 | int x, |
| 92 | int y, |
| 93 | uint32_t flags) override; |
| 94 | void shell_surface_set_fullscreen(Resource *resource, |
| 95 | uint32_t method, |
| 96 | uint32_t framerate, |
| 97 | struct wl_resource *output_resource) override; |
| 98 | void shell_surface_set_popup(Resource *resource, |
| 99 | struct wl_resource *input_device, |
| 100 | uint32_t time, |
| 101 | struct wl_resource *parent, |
| 102 | int32_t x, |
| 103 | int32_t y, |
| 104 | uint32_t flags) override; |
| 105 | void shell_surface_set_maximized(Resource *resource, |
| 106 | struct wl_resource *output_resource) override; |
| 107 | void shell_surface_pong(Resource *resource, |
| 108 | uint32_t serial) override; |
| 109 | void shell_surface_set_title(Resource *resource, |
| 110 | const QString &title) override; |
| 111 | void shell_surface_set_class(Resource *resource, |
| 112 | const QString &class_) override; |
| 113 | |
| 114 | static QWaylandSurfaceRole s_role; |
| 115 | }; |
| 116 | |
| 117 | QT_END_NAMESPACE |
| 118 | |
| 119 | #endif // QWAYLANDWLSHELL_P_H |
| 120 | |