Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwaylandxdgshell_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// Copyright (C) 2017 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QWAYLANDXDGSHELL_H
6#define QWAYLANDXDGSHELL_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include "qwayland-xdg-shell.h"
20
23
24#include <QtWaylandClient/qtwaylandclientglobal.h>
25#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
26#include <QtWaylandClient/private/qwaylandwindow_p.h>
27
28#include <QtCore/QSize>
29#include <QtGui/QRegion>
30
32
33class QWindow;
34
35namespace QtWaylandClient {
36
37class QWaylandDisplay;
38class QWaylandInputDevice;
40class QWaylandXdgExportedV2;
41class QWaylandXdgExporterV2;
42class QWaylandXdgDialogWmV1;
44
45class Q_WAYLANDCLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface, public QtWayland::xdg_surface
46{
48public:
49 QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window);
50 ~QWaylandXdgSurface() override;
51
52 bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
53 bool move(QWaylandInputDevice *inputDevice) override;
54 bool showWindowMenu(QWaylandInputDevice *seat) override;
55 void setTitle(const QString &title) override;
56 void setAppId(const QString &appId) override;
57 void setWindowFlags(Qt::WindowFlags flags) override;
58
59 bool isExposed() const override;
60 bool handleExpose(const QRegion &) override;
61 bool handlesActiveState() const { return m_toplevel; }
62 void applyConfigure() override;
63 bool wantsDecorations() const override;
64 void propagateSizeHints() override;
65 void setWindowGeometry(const QRect &rect) override;
66 bool requestActivate() override;
67 bool requestActivateOnShow() override;
68 void setXdgActivationToken(const QString &token) override;
69 void requestXdgActivationToken(quint32 serial) override;
70 void setAlertState(bool enabled) override;
71 bool isAlertState() const override { return m_alertState; }
72 QString externWindowHandle() override;
73
74 void setSizeHints();
75
76 void *nativeResource(const QByteArray &resource);
77
78 std::any surfaceRole() const override;
79
80protected:
81 void requestWindowStates(Qt::WindowStates states) override;
82 void xdg_surface_configure(uint32_t serial) override;
83
84private:
85 class Toplevel: public QtWayland::xdg_toplevel
86 {
87 public:
88 Toplevel(QWaylandXdgSurface *xdgSurface);
89 ~Toplevel() override;
90
91 void applyConfigure();
92 bool wantsDecorations();
93
94 void xdg_toplevel_configure(int32_t width, int32_t height, wl_array *states) override;
95 void xdg_toplevel_close() override;
96 void xdg_toplevel_configure_bounds(int32_t width, int32_t height) override;
97
98 void requestWindowFlags(Qt::WindowFlags flags);
99 void requestWindowStates(Qt::WindowStates states);
100
101 static resize_edge convertToResizeEdges(Qt::Edges edges);
102
103 struct {
104 QSize bounds = {0, 0};
105 QSize size = {0, 0};
106 Qt::WindowStates states = Qt::WindowNoState;
107 bool suspended = false;
108 } m_pending, m_applied;
109 QWaylandWindow::ToplevelWindowTilingStates m_toplevelStates = QWaylandWindow::WindowNoState;
110 QSize m_normalSize;
111
112 QWaylandXdgSurface *m_xdgSurface = nullptr;
113 QWaylandXdgToplevelDecorationV1 *m_decoration = nullptr;
114 QScopedPointer<QWaylandXdgExportedV2> m_exported;
115 QScopedPointer<QWaylandXdgDialogV1> m_xdgDialog;
116 };
117
118 class Popup : public QtWayland::xdg_popup {
119 public:
120 Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent, QtWayland::xdg_positioner *positioner);
121 ~Popup() override;
122
123 void applyConfigure();
124 void resetConfiguration();
125
126 void grab(QWaylandInputDevice *seat, uint serial);
127 void xdg_popup_configure(int32_t x, int32_t y, int32_t width, int32_t height) override;
128 void xdg_popup_popup_done() override;
129
130 QWaylandXdgSurface *m_xdgSurface = nullptr;
131 QWaylandXdgSurface *m_parentXdgSurface = nullptr;
132 QWaylandWindow *m_parent = nullptr;
133 bool m_grabbing = false;
134
135 QRect m_pendingGeometry;
136 };
137
138 void setToplevel();
139 void setPopup(QWaylandWindow *parent);
140 void setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial);
141
142 QWaylandXdgShell *m_shell = nullptr;
143 QWaylandWindow *m_window = nullptr;
144 Toplevel *m_toplevel = nullptr;
145 Popup *m_popup = nullptr;
146 bool m_configured = false;
147 uint m_pendingConfigureSerial = 0;
148 uint m_appliedConfigureSerial = 0;
149 QString m_activationToken;
150 QString m_appId;
151 bool m_alertState = false;
152
153 friend class QWaylandXdgShell;
154};
155
156class Q_WAYLANDCLIENT_EXPORT QWaylandXdgShell
157{
158public:
159 QWaylandXdgShell(QWaylandDisplay *display, QtWayland::xdg_wm_base *xdg_wm_base);
161
162 QWaylandDisplay *display() const { return m_display; }
163
164 QWaylandXdgDecorationManagerV1 *decorationManager() { return m_xdgDecorationManager.data(); }
165 QWaylandXdgActivationV1 *activation() const { return m_xdgActivation.data(); }
166 QWaylandXdgExporterV2 *exporter() const { return m_xdgExporter.data(); }
168
169private:
170 static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint id,
171 const QString &interface, uint version);
172
173 QWaylandDisplay *m_display = nullptr;
174 QtWayland::xdg_wm_base *m_xdgWmBase = nullptr;
175 QScopedPointer<QWaylandXdgDecorationManagerV1> m_xdgDecorationManager;
176 QScopedPointer<QWaylandXdgActivationV1> m_xdgActivation;
177 QScopedPointer<QWaylandXdgExporterV2> m_xdgExporter;
178 QScopedPointer<QWaylandXdgDialogWmV1> m_xdgDialogWm;
179
180 friend class QWaylandXdgSurface;
181};
182
184
185}
186
187#endif // QWAYLANDXDGSHELL_H
IOBluetoothDevice * device
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\qmltype XdgShell \instantiates QWaylandXdgShell \inqmlmodule QtWayland.Compositor....
\qmltype XdgSurface \instantiates QWaylandXdgSurface \inqmlmodule QtWayland.Compositor....
\inmodule QtGui
Definition qwindow.h:63
QWaylandXdgDecorationManagerV1 * decorationManager()
QWaylandDisplay * display() const
QWaylandXdgSurface * getXdgSurface(QWaylandWindow *window)
QWaylandXdgActivationV1 * activation() const
QWaylandXdgExporterV2 * exporter() const
a resize(100000)
rect
[4]
Token token
Definition keywords.cpp:444
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
@ WindowNoState
Definition qnamespace.h:252
@ Popup
Definition qnamespace.h:211
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char * interface
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei width
GLbitfield flags
GLint y
GLuint * states
#define Q_OBJECT
unsigned int quint32
Definition qtypes.h:50
unsigned int uint
Definition qtypes.h:34
QString title
[35]
aWidget window() -> setWindowTitle("New Window Title")
[2]
g setTitle("&User information")
[0]