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/qwaylandcompositorextension_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//
22// W A R N I N G
23// -------------
24//
25// This file is not part of the Qt API. It exists purely as an
26// implementation detail. This header file may change from version to
27// version without notice, or even be removed.
28//
29// We mean it.
30//
31
32QT_BEGIN_NAMESPACE
33
34class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandWlShellPrivate
35 : public QWaylandShellPrivate
36 , public QtWaylandServer::wl_shell
37{
38 Q_DECLARE_PUBLIC(QWaylandWlShell)
39public:
40 QWaylandWlShellPrivate();
41
42 void unregisterShellSurface(QWaylandWlShellSurface *shellSurface);
43
44 static QWaylandWlShellPrivate *get(QWaylandWlShell *shell) { return shell->d_func(); }
45
46protected:
47 void shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) override;
48
49 QList<QWaylandWlShellSurface *> m_shellSurfaces;
50};
51
52class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandWlShellSurfacePrivate
53 : public QWaylandCompositorExtensionPrivate
54 , public QtWaylandServer::wl_shell_surface
55{
56 Q_DECLARE_PUBLIC(QWaylandWlShellSurface)
57public:
58 QWaylandWlShellSurfacePrivate();
59 ~QWaylandWlShellSurfacePrivate() override;
60
61 static QWaylandWlShellSurfacePrivate *get(QWaylandWlShellSurface *surface) { return surface->d_func(); }
62
63 void ping(uint32_t serial);
64
65 void setWindowType(Qt::WindowType windowType);
66
67private:
68 QWaylandWlShell *m_shell = nullptr;
69 QPointer<QWaylandSurface> m_surface;
70
71 QSet<uint32_t> m_pings;
72
73 QString m_title;
74 QString m_className;
75 Qt::WindowType m_windowType = Qt::WindowType::Window;
76
77 void shell_surface_destroy_resource(Resource *resource) override;
78
79 void shell_surface_move(Resource *resource,
80 struct wl_resource *input_device_super,
81 uint32_t time) override;
82 void shell_surface_resize(Resource *resource,
83 struct wl_resource *input_device,
84 uint32_t time,
85 uint32_t edges) override;
86 void shell_surface_set_toplevel(Resource *resource) override;
87 void shell_surface_set_transient(Resource *resource,
88 struct wl_resource *parent_surface_resource,
89 int x,
90 int y,
91 uint32_t flags) override;
92 void shell_surface_set_fullscreen(Resource *resource,
93 uint32_t method,
94 uint32_t framerate,
95 struct wl_resource *output_resource) override;
96 void shell_surface_set_popup(Resource *resource,
97 struct wl_resource *input_device,
98 uint32_t time,
99 struct wl_resource *parent,
100 int32_t x,
101 int32_t y,
102 uint32_t flags) override;
103 void shell_surface_set_maximized(Resource *resource,
104 struct wl_resource *output_resource) override;
105 void shell_surface_pong(Resource *resource,
106 uint32_t serial) override;
107 void shell_surface_set_title(Resource *resource,
108 const QString &title) override;
109 void shell_surface_set_class(Resource *resource,
110 const QString &class_) override;
111
112 static QWaylandSurfaceRole s_role;
113};
114
115QT_END_NAMESPACE
116
117#endif // QWAYLANDWLSHELL_P_H
118

source code of qtwayland/src/compositor/extensions/qwaylandwlshell_p.h