Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwaylandxdgshell.cpp
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "qwaylandxdgshell.h"
6
7#if QT_CONFIG(wayland_compositor_quick)
8#include "qwaylandxdgshellintegration_p.h"
9#endif
10#include <QtWaylandCompositor/private/qwaylandutils_p.h>
11
12#include <QtWaylandCompositor/QWaylandCompositor>
13#include <QtWaylandCompositor/QWaylandSeat>
14#include <QtWaylandCompositor/QWaylandSurface>
15#include <QtWaylandCompositor/QWaylandSurfaceRole>
16#include <QtWaylandCompositor/QWaylandResource>
17
18#include <QtCore/QObject>
19
20#include <algorithm>
21
23
25{
26}
27
28void QWaylandXdgShellPrivate::ping(QtWaylandServer::xdg_wm_base::Resource *resource, uint32_t serial)
29{
30 m_pings.insert(serial);
31 send_ping(resource->handle, serial);
32}
33
35{
36 m_xdgSurfaces.insert(xdgSurface->surface()->client()->client(), xdgSurface);
37}
38
40{
41 auto xdgSurfacePrivate = QWaylandXdgSurfacePrivate::get(xdgSurface);
42 if (!m_xdgSurfaces.remove(xdgSurfacePrivate->resource()->client(), xdgSurface))
43 qWarning("%s Unexpected state. Can't find registered xdg surface\n", Q_FUNC_INFO);
44}
45
47{
48 for (QWaylandXdgSurface *xdgSurface : std::as_const(m_xdgSurfaces)) {
49 if (surface == xdgSurface->surface())
50 return xdgSurface;
51 }
52 return nullptr;
53}
54
56{
57 if (!m_xdgSurfaces.values(resource->client()).empty())
58 wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_DEFUNCT_SURFACES,
59 "xdg_shell was destroyed before children");
60
61 wl_resource_destroy(resource->handle);
62}
63
64void QWaylandXdgShellPrivate::xdg_wm_base_create_positioner(QtWaylandServer::xdg_wm_base::Resource *resource, uint32_t id)
65{
66 QWaylandResource positionerResource(wl_resource_create(resource->client(), &xdg_positioner_interface,
67 wl_resource_get_version(resource->handle), id));
68
69 new QWaylandXdgPositioner(positionerResource);
70}
71
72void QWaylandXdgShellPrivate::xdg_wm_base_get_xdg_surface(Resource *resource, uint32_t id, wl_resource *surfaceResource)
73{
75 QWaylandSurface *surface = QWaylandSurface::fromResource(surfaceResource);
76
77 if (surface->role() != nullptr) {
78 wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_ROLE,
79 "wl_surface@%d, already has role %s\n",
80 wl_resource_get_id(surface->resource()),
81 surface->role()->name().constData());
82 return;
83 }
84
85 if (surface->hasContent()) {
86 //TODO: According to the spec, this is a client error, but there's no appropriate error code
87 qWarning() << "get_xdg_surface requested on a xdg_surface with content";
88 }
89
90 QWaylandResource xdgSurfaceResource(wl_resource_create(resource->client(), &xdg_surface_interface,
91 wl_resource_get_version(resource->handle), id));
92
93 QWaylandXdgSurface *xdgSurface = new QWaylandXdgSurface(q, surface, xdgSurfaceResource);
94
95 registerXdgSurface(xdgSurface);
96 emit q->xdgSurfaceCreated(xdgSurface);
97}
98
99void QWaylandXdgShellPrivate::xdg_wm_base_pong(Resource *resource, uint32_t serial)
100{
101 Q_UNUSED(resource);
102 Q_Q(QWaylandXdgShell);
103 if (m_pings.remove(serial))
104 emit q->pong(serial);
105 else
106 qWarning("Received an unexpected pong!");
107}
108
155{
156}
157
163{
164}
165
170{
171 Q_D(QWaylandXdgShell);
174 if (!compositor) {
175 qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandXdgShell";
176 return;
177 }
178 d->init(compositor->display(), 1);
179
180 handleSeatChanged(compositor->defaultSeat(), nullptr);
181
182 connect(compositor, &QWaylandCompositor::defaultSeatChanged,
183 this, &QWaylandXdgShell::handleSeatChanged);
184}
185
189const struct wl_interface *QWaylandXdgShell::interface()
190{
191 return QWaylandXdgShellPrivate::interface();
192}
193
195{
196 return QWaylandXdgShellPrivate::interfaceName();
197}
198
211{
212 Q_D(QWaylandXdgShell);
213
216
217 uint32_t serial = compositor->nextSerial();
218
219 QWaylandXdgShellPrivate::Resource *clientResource = d->resourceMap().value(client->client(), nullptr);
220 Q_ASSERT(clientResource);
221
222 d->ping(clientResource, serial);
223 return serial;
224}
225
226void QWaylandXdgShell::handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat)
227{
228 if (oldSeat != nullptr) {
230 this, &QWaylandXdgShell::handleFocusChanged);
231 }
232
233 if (newSeat != nullptr) {
235 this, &QWaylandXdgShell::handleFocusChanged);
236 }
237}
238
239void QWaylandXdgShell::handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface)
240{
241 Q_D(QWaylandXdgShell);
242
243 QWaylandXdgSurface *newXdgSurface = d->xdgSurfaceFromSurface(newSurface);
244 QWaylandXdgSurface *oldXdgSurface = d->xdgSurfaceFromSurface(oldSurface);
245
246 if (newXdgSurface)
248
249 if (oldXdgSurface)
251}
252
254{
255}
256
258{
259 if (m_windowType == windowType)
260 return;
261
262 m_windowType = windowType;
263
265 emit q->windowTypeChanged();
266}
267
269{
270 if (m_toplevel)
272}
273
275{
276 if (m_toplevel)
278}
279
281{
282 // TODO: The unset window geometry should include subsurfaces as well, so this solution
283 // won't work too well on those kinds of clients.
284 return QRect(QPoint(), m_surface->destinationSize());
285}
286
288{
290 if (!m_unsetWindowGeometry)
291 return;
292
293 const QRect unsetGeometry = calculateFallbackWindowGeometry();
294 if (unsetGeometry == m_windowGeometry)
295 return;
296
297 m_windowGeometry = unsetGeometry;
298 emit q->windowGeometryChanged();
299}
300
301void QWaylandXdgSurfacePrivate::xdg_surface_destroy_resource(QtWaylandServer::xdg_surface::Resource *resource)
302{
303 Q_UNUSED(resource);
306 delete q;
307}
308
309void QWaylandXdgSurfacePrivate::xdg_surface_destroy(QtWaylandServer::xdg_surface::Resource *resource)
310{
311 wl_resource_destroy(resource->handle);
312}
313
314void QWaylandXdgSurfacePrivate::xdg_surface_get_toplevel(QtWaylandServer::xdg_surface::Resource *resource, uint32_t id)
315{
317
318 if (m_toplevel || m_popup) {
319 wl_resource_post_error(resource->handle, XDG_SURFACE_ERROR_ALREADY_CONSTRUCTED,
320 "xdg_surface already has a role object");
321 return;
322 }
323
324 if (!m_surface->setRole(QWaylandXdgToplevel::role(), resource->handle, XDG_WM_BASE_ERROR_ROLE))
325 return;
326
327 QWaylandResource topLevelResource(wl_resource_create(resource->client(), &xdg_toplevel_interface,
328 wl_resource_get_version(resource->handle), id));
329
330 m_toplevel = new QWaylandXdgToplevel(q, topLevelResource);
331 emit q->toplevelCreated();
332 emit m_xdgShell->toplevelCreated(m_toplevel, q);
333}
334
335void QWaylandXdgSurfacePrivate::xdg_surface_get_popup(QtWaylandServer::xdg_surface::Resource *resource, uint32_t id, wl_resource *parentResource, wl_resource *positionerResource)
336{
338
339 if (m_toplevel || m_popup) {
340 wl_resource_post_error(resource->handle, XDG_SURFACE_ERROR_ALREADY_CONSTRUCTED,
341 "xdg_surface already has a role object");
342 return;
343 }
344
346 if (!parent) {
347 wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT,
348 "xdg_surface.get_popup with invalid popup parent");
349 return;
350 }
351
352 QWaylandXdgPositioner *positioner = QWaylandXdgPositioner::fromResource(positionerResource);
353 if (!positioner) {
354 wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_INVALID_POSITIONER,
355 "xdg_surface.get_popup without positioner");
356 return;
357 }
358
359 if (!positioner->m_data.isComplete()) {
360 QWaylandXdgPositionerData p = positioner->m_data;
361 wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_INVALID_POSITIONER,
362 "xdg_surface.get_popup with invalid positioner (size: %dx%d, anchorRect: %dx%d)",
363 p.size.width(), p.size.height(), p.anchorRect.width(), p.anchorRect.height());
364 return;
365 }
366
367 QRect anchorBounds(QPoint(0, 0), parent->windowGeometry().size());
368 if (!anchorBounds.contains(positioner->m_data.anchorRect)) {
369 // TODO: this is a protocol error and should ideally be handled like this:
370 //wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_INVALID_POSITIONER,
371 // "xdg_positioner anchor rect extends beyound its parent's window geometry");
372 //return;
373 // However, our own clients currently do this, so we'll settle for a gentle warning instead.
374 qCWarning(qLcWaylandCompositor) << "Ignoring client protocol error: xdg_positioner anchor"
375 << "rect extends beyond its parent's window geometry";
376 }
377
378 if (!m_surface->setRole(QWaylandXdgPopup::role(), resource->handle, XDG_WM_BASE_ERROR_ROLE))
379 return;
380
381 QWaylandResource popupResource(wl_resource_create(resource->client(), &xdg_popup_interface,
382 wl_resource_get_version(resource->handle), id));
383
384 m_popup = new QWaylandXdgPopup(q, parent, positioner, popupResource);
385 emit q->popupCreated();
386 emit m_xdgShell->popupCreated(m_popup, q);
387}
388
389void QWaylandXdgSurfacePrivate::xdg_surface_ack_configure(QtWaylandServer::xdg_surface::Resource *resource, uint32_t serial)
390{
391 if (m_toplevel) {
393 } else if (m_popup) {
395 } else {
396 wl_resource_post_error(resource->handle, XDG_SURFACE_ERROR_NOT_CONSTRUCTED,
397 "ack_configure requested on an unconstructed xdg_surface");
398 }
399}
400
401void QWaylandXdgSurfacePrivate::xdg_surface_set_window_geometry(QtWaylandServer::xdg_surface::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
402{
404
405 if (!q->surface()->role()) {
406 wl_resource_post_error(resource->handle, XDG_SURFACE_ERROR_NOT_CONSTRUCTED,
407 "set_window_geometry requested on an unconstructed xdg_surface");
408 return;
409 }
410
411 if (width <= 0 || height <= 0) {
412 // The protocol spec says "setting an invalid size will raise an error". But doesn't tell
413 // which error to raise, and there's no fitting error in the xdg_surface_error enum.
414 // So until this is fixed, just output a warning and return.
415 qWarning() << "Invalid (non-positive) dimensions received in set_window_geometry";
416 return;
417 }
418
419 m_unsetWindowGeometry = false;
420
421 QRect geometry(x, y, width, height);
422
423 if (m_windowGeometry == geometry)
424 return;
425
426 m_windowGeometry = geometry;
427 emit q->windowGeometryChanged();
428}
429
464{
465}
466
473{
474 initialize(xdgShell, surface, res);
475}
476
489{
491 d->m_xdgShell = xdgShell;
492 d->m_surface = surface;
493 d->init(resource.resource());
495 d->m_windowGeometry = d->calculateFallbackWindowGeometry();
496 connect(surface, &QWaylandSurface::destinationSizeChanged, this, &QWaylandXdgSurface::handleSurfaceSizeChanged);
497 connect(surface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandXdgSurface::handleBufferScaleChanged);
501}
502
509{
510 Q_D(const QWaylandXdgSurface);
511 return d->m_windowType;
512}
513
534{
535 Q_D(const QWaylandXdgSurface);
536 return d->m_windowGeometry;
537}
538
543{
545}
546
547void QWaylandXdgSurface::handleSurfaceSizeChanged()
548{
550 d->updateFallbackWindowGeometry();
551}
552
553void QWaylandXdgSurface::handleBufferScaleChanged()
554{
556 d->updateFallbackWindowGeometry();
557}
558
571{
572 Q_D(const QWaylandXdgSurface);
573 return d->m_xdgShell;
574}
575
588{
589 Q_D(const QWaylandXdgSurface);
590 return d->m_surface;
591}
592
611{
612 Q_D(const QWaylandXdgSurface);
613 return d->m_toplevel;
614}
615
634{
635 Q_D(const QWaylandXdgSurface);
636 return d->m_popup;
637}
638
642const wl_interface *QWaylandXdgSurface::interface()
643{
644 return QWaylandXdgSurfacePrivate::interface();
645}
646
651{
652 return QWaylandXdgSurfacePrivate::interfaceName();
653}
654
659{
660 if (auto p = QtWayland::fromResource<QWaylandXdgSurfacePrivate *>(resource))
661 return p->q_func();
662 return nullptr;
663}
664
665#if QT_CONFIG(wayland_compositor_quick)
666QWaylandQuickShellIntegration *QWaylandXdgSurface::createIntegration(QWaylandQuickShellSurfaceItem *item)
667{
668 Q_D(const QWaylandXdgSurface);
669
670 if (d->m_toplevel)
672
673 if (d->m_popup)
675
676 return nullptr;
677}
678#endif
679
711 : QObject(*new QWaylandXdgToplevelPrivate(xdgSurface, resource))
712{
714 sendConfigure({0, 0}, states);
715}
716
718{
720 // Usually, the decoration is destroyed by the client (according to the protocol),
721 // but if the client misbehaves, or is shut down, we need to clean up here.
722 if (Q_UNLIKELY(d->m_decoration))
723 wl_resource_destroy(d->m_decoration->resource()->handle);
724 Q_ASSERT(!d->m_decoration);
725}
726
739{
740 Q_D(const QWaylandXdgToplevel);
741 return d->m_xdgSurface;
742}
743
757{
758 Q_D(const QWaylandXdgToplevel);
759 return d->m_parentToplevel;
760}
761
774{
775 Q_D(const QWaylandXdgToplevel);
776 return d->m_title;
777}
778
791{
792 Q_D(const QWaylandXdgToplevel);
793 return d->m_appId;
794}
795
812{
813 Q_D(const QWaylandXdgToplevel);
814 return d->m_maxSize;
815}
816
833{
834 Q_D(const QWaylandXdgToplevel);
835 return d->m_minSize;
836}
837
844{
845 Q_D(const QWaylandXdgToplevel);
846 return d->m_lastAckedConfigure.states;
847}
848
861{
862 Q_D(const QWaylandXdgToplevel);
863 return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevel::State::MaximizedState);
864}
865
878{
879 Q_D(const QWaylandXdgToplevel);
880 return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevel::State::FullscreenState);
881}
882
895{
896 Q_D(const QWaylandXdgToplevel);
897 return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevel::State::ResizingState);
898}
899
912{
913 Q_D(const QWaylandXdgToplevel);
914 return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevel::State::ActivatedState);
915}
916
946{
947 Q_D(const QWaylandXdgToplevel);
948 return d->m_decoration ? d->m_decoration->configuredMode() : DecorationMode::ClientSideDecoration;
949}
950
962QSize QWaylandXdgToplevel::sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const
963{
964 qreal width = size.width();
965 qreal height = size.height();
966 if (edges & Qt::LeftEdge)
967 width -= delta.x();
968 else if (edges & Qt::RightEdge)
969 width += delta.x();
970
971 if (edges & Qt::TopEdge)
972 height -= delta.y();
973 else if (edges & Qt::BottomEdge)
974 height += delta.y();
975
976 QSize newSize = QSize(width, height)
978 .expandedTo({1, 1}); // We don't want to send a size of (0,0) as that means that the client decides
979
980 if (maxSize().isValid())
981 newSize = newSize.boundedTo(maxSize());
982
983 return newSize;
984}
985
992{
993 if (!size.isValid()) {
994 qWarning() << "Can't configure xdg_toplevel with an invalid size" << size;
995 return 0;
996 }
998 auto statesBytes = QByteArray::fromRawData(reinterpret_cast<const char *>(states.data()),
999 states.size() * static_cast<int>(sizeof(State)));
1000 uint32_t serial = d->m_xdgSurface->surface()->compositor()->nextSerial();
1001 d->m_pendingConfigures.append(QWaylandXdgToplevelPrivate::ConfigureEvent{states, size, serial});
1002 d->send_configure(size.width(), size.height(), statesBytes);
1003 QWaylandXdgSurfacePrivate::get(d->m_xdgSurface)->send_configure(serial);
1004 return serial;
1005}
1006
1015{
1017 for (auto state : states)
1018 s << State(state);
1019 return sendConfigure(size, s);
1020}
1021
1032{
1034 d->send_close();
1035}
1036
1053{
1055 QWaylandXdgToplevelPrivate::ConfigureEvent conf = d->lastSentConfigure();
1056
1061
1062 return sendConfigure(size, conf.states);
1063}
1064
1083{
1085 QWaylandXdgToplevelPrivate::ConfigureEvent conf = d->lastSentConfigure();
1086
1090
1091 return sendConfigure(size, conf.states);
1092
1093}
1094
1115{
1117 QWaylandXdgToplevelPrivate::ConfigureEvent conf = d->lastSentConfigure();
1118
1123
1124 return sendConfigure(size, conf.states);
1125}
1126
1143{
1145 QWaylandXdgToplevelPrivate::ConfigureEvent conf = d->lastSentConfigure();
1146
1151
1152 return sendConfigure(maxSize, conf.states);
1153}
1154
1159{
1161}
1162
1167{
1168 if (auto p = QtWayland::fromResource<QWaylandXdgToplevelPrivate *>(resource))
1169 return p->q_func();
1170 return nullptr;
1171}
1172
1249QList<int> QWaylandXdgToplevel::statesAsInts() const
1250{
1252 const auto s = states();
1253 list.reserve(s.size());
1254 for (auto state : s) {
1255 list << static_cast<int>(state);
1256 }
1257 return list;
1258}
1259
1261
1263 : m_xdgSurface(xdgSurface)
1264{
1265 init(resource.resource());
1266}
1267
1269{
1272 Q_FOREVER {
1273 if (m_pendingConfigures.empty()) {
1274 qWarning("Toplevel received an unexpected ack_configure!");
1275 return;
1276 }
1277
1278 // This won't work unless there always is a toplevel.configure for each xdgsurface.configure
1279 config = m_pendingConfigures.takeFirst();
1280
1281 if (config.serial == serial)
1282 break;
1283 }
1284
1285 QList<uint> changedStates;
1286 std::set_symmetric_difference(
1288 config.states.begin(), config.states.end(),
1289 std::back_inserter(changedStates));
1290
1292
1293 for (uint state : changedStates) {
1294 switch (state) {
1295 case state_maximized:
1296 emit q->maximizedChanged();
1297 break;
1298 case state_fullscreen:
1299 emit q->fullscreenChanged();
1300 break;
1301 case state_resizing:
1302 emit q->resizingChanged();
1303 break;
1304 case state_activated:
1305 emit q->activatedChanged();
1306 break;
1307 }
1308 }
1309
1310 if (!changedStates.empty())
1311 emit q->statesChanged();
1312}
1313
1315{
1319 q->sendConfigure(current.size, current.states);
1320}
1321
1323{
1328 q->sendConfigure(current.size, current.states);
1329 }
1330}
1331
1333{
1334 return Qt::Edges(((edge & 0b1100) >> 1) | ((edge & 0b0010) << 2) | (edge & 0b0001));
1335}
1336
1337void QWaylandXdgToplevelPrivate::xdg_toplevel_destroy_resource(QtWaylandServer::xdg_toplevel::Resource *resource)
1338{
1339 Q_UNUSED(resource);
1341 delete q;
1342}
1343
1344void QWaylandXdgToplevelPrivate::xdg_toplevel_destroy(QtWaylandServer::xdg_toplevel::Resource *resource)
1345{
1347 qWarning() << "Client error: xdg_toplevel destroyed before its decoration object";
1348
1349 wl_resource_destroy(resource->handle);
1350 //TODO: Should the xdg surface be desroyed as well? Or is it allowed to recreate a new toplevel for it?
1351}
1352
1353void QWaylandXdgToplevelPrivate::xdg_toplevel_set_parent(QtWaylandServer::xdg_toplevel::Resource *resource, wl_resource *parent)
1354{
1355 Q_UNUSED(resource);
1357
1359
1360 if (m_parentToplevel != parentToplevel) {
1361 m_parentToplevel = parentToplevel;
1362 emit q->parentToplevelChanged();
1363 }
1364
1366 // There's a parent now, which means the surface is transient
1369 // When the surface has no parent it is toplevel
1371 }
1372}
1373
1374void QWaylandXdgToplevelPrivate::xdg_toplevel_set_title(QtWaylandServer::xdg_toplevel::Resource *resource, const QString &title)
1375{
1376 Q_UNUSED(resource);
1377 if (title == m_title)
1378 return;
1380 m_title = title;
1381 emit q->titleChanged();
1382}
1383
1384void QWaylandXdgToplevelPrivate::xdg_toplevel_set_app_id(QtWaylandServer::xdg_toplevel::Resource *resource, const QString &app_id)
1385{
1386 Q_UNUSED(resource);
1387 if (app_id == m_appId)
1388 return;
1390 m_appId = app_id;
1391 emit q->appIdChanged();
1392}
1393
1394void QWaylandXdgToplevelPrivate::xdg_toplevel_show_window_menu(QtWaylandServer::xdg_toplevel::Resource *resource, wl_resource *seatResource, uint32_t serial, int32_t x, int32_t y)
1395{
1396 Q_UNUSED(resource);
1397 Q_UNUSED(serial);
1398 QPoint position(x, y);
1399 auto seat = QWaylandSeat::fromSeatResource(seatResource);
1401 emit q->showWindowMenu(seat, position);
1402}
1403
1404void QWaylandXdgToplevelPrivate::xdg_toplevel_move(Resource *resource, wl_resource *seatResource, uint32_t serial)
1405{
1406 Q_UNUSED(resource);
1407 Q_UNUSED(serial);
1409 QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
1410 emit q->startMove(seat);
1411}
1412
1413void QWaylandXdgToplevelPrivate::xdg_toplevel_resize(QtWaylandServer::xdg_toplevel::Resource *resource, wl_resource *seatResource, uint32_t serial, uint32_t edges)
1414{
1415 Q_UNUSED(resource);
1416 Q_UNUSED(serial);
1418 QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
1419 emit q->startResize(seat, convertToEdges(resize_edge(edges)));
1420}
1421
1422void QWaylandXdgToplevelPrivate::xdg_toplevel_set_max_size(QtWaylandServer::xdg_toplevel::Resource *resource, int32_t width, int32_t height)
1423{
1424 Q_UNUSED(resource);
1425
1426 QSize maxSize(width, height);
1427 if (width == 0 && height == 0)
1428 maxSize = QSize(); // Wayland size of zero means unspecified which best translates to invalid
1429
1430 if (m_maxSize == maxSize)
1431 return;
1432
1433 if (width < 0 || height < 0) {
1434 // The spec says raise a protocol error, but there's no matching error defined
1435 qWarning() << "Received a xdg_toplevel.set_max_size request with a negative size";
1436 return;
1437 }
1438
1439 if (m_minSize.isValid() && maxSize.isValid() &&
1440 (maxSize.width() < m_minSize.width() || maxSize.height() < m_minSize.height())) {
1441 // The spec says raise a protocol error, but there's no matching error defined
1442 qWarning() << "Received a xdg_toplevel.set_max_size request with a size smaller than the minimium size";
1443 return;
1444 }
1445
1446 m_maxSize = maxSize;
1447
1449 emit q->maxSizeChanged();
1450}
1451
1452void QWaylandXdgToplevelPrivate::xdg_toplevel_set_min_size(QtWaylandServer::xdg_toplevel::Resource *resource, int32_t width, int32_t height)
1453{
1454 Q_UNUSED(resource);
1455
1456 QSize minSize(width, height);
1457 if (width == 0 && height == 0)
1458 minSize = QSize(); // Wayland size of zero means unspecified
1459
1460 if (m_minSize == minSize)
1461 return;
1462
1463 if (width < 0 || height < 0) {
1464 // The spec says raise a protocol error, but there's no matching error defined
1465 qWarning() << "Received a xdg_toplevel.set_min_size request with a negative size";
1466 return;
1467 }
1468
1469 if (m_maxSize.isValid() && minSize.isValid() &&
1470 (minSize.width() > m_maxSize.width() || minSize.height() > m_maxSize.height())) {
1471 // The spec says raise a protocol error, but there's no matching error defined
1472 qWarning() << "Received a xdg_toplevel.set_min_size request with a size larger than the maximum size";
1473 return;
1474 }
1475
1476 m_minSize = minSize;
1477
1479 emit q->minSizeChanged();
1480}
1481
1482void QWaylandXdgToplevelPrivate::xdg_toplevel_set_maximized(QtWaylandServer::xdg_toplevel::Resource *resource)
1483{
1484 Q_UNUSED(resource);
1486 emit q->setMaximized();
1487}
1488
1489void QWaylandXdgToplevelPrivate::xdg_toplevel_unset_maximized(QtWaylandServer::xdg_toplevel::Resource *resource)
1490{
1491 Q_UNUSED(resource);
1493 emit q->unsetMaximized();
1494}
1495
1496void QWaylandXdgToplevelPrivate::xdg_toplevel_set_fullscreen(QtWaylandServer::xdg_toplevel::Resource *resource, wl_resource *output_res)
1497{
1498 Q_UNUSED(resource);
1500 QWaylandOutput *output = output_res ? QWaylandOutput::fromResource(output_res) : nullptr;
1501 emit q->setFullscreen(output);
1502}
1503
1504void QWaylandXdgToplevelPrivate::xdg_toplevel_unset_fullscreen(QtWaylandServer::xdg_toplevel::Resource *resource)
1505{
1506 Q_UNUSED(resource);
1508 emit q->unsetFullscreen();
1509}
1510
1511void QWaylandXdgToplevelPrivate::xdg_toplevel_set_minimized(QtWaylandServer::xdg_toplevel::Resource *resource)
1512{
1513 Q_UNUSED(resource);
1515 emit q->setMinimized();
1516}
1517
1548QWaylandXdgPopup::QWaylandXdgPopup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parentXdgSurface,
1549 QWaylandXdgPositioner *positioner, QWaylandResource &resource)
1550 : QObject(*new QWaylandXdgPopupPrivate(xdgSurface, parentXdgSurface, positioner, resource))
1551{
1552}
1553
1566{
1567 Q_D(const QWaylandXdgPopup);
1568 return d->m_xdgSurface;
1569}
1570
1584{
1585 Q_D(const QWaylandXdgPopup);
1586 return d->m_parentXdgSurface;
1587}
1588
1603{
1604 Q_D(const QWaylandXdgPopup);
1605 return d->m_geometry;
1606}
1607
1622{
1623 Q_D(const QWaylandXdgPopup);
1624 return d->m_positionerData.anchorRect;
1625}
1626
1649{
1650 Q_D(const QWaylandXdgPopup);
1651 return d->m_positionerData.anchorEdges;
1652}
1653
1674{
1675 Q_D(const QWaylandXdgPopup);
1676 return d->m_positionerData.gravityEdges;
1677}
1678
1695{
1696 Q_D(const QWaylandXdgPopup);
1697 const uint flags = d->m_positionerData.constraintAdjustments;
1698
1699 Qt::Orientations constraints = {};
1700
1701 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X)
1702 constraints |= Qt::Horizontal;
1703 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y)
1704 constraints |= Qt::Vertical;
1705
1706 return constraints;
1707}
1708
1725{
1726 Q_D(const QWaylandXdgPopup);
1727 const uint flags = d->m_positionerData.constraintAdjustments;
1728
1729 Qt::Orientations constraints = {};
1730
1731 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X)
1732 constraints |= Qt::Horizontal;
1733 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y)
1734 constraints |= Qt::Vertical;
1735
1736 return constraints;
1737}
1738
1755{
1756 Q_D(const QWaylandXdgPopup);
1757 const uint flags = d->m_positionerData.constraintAdjustments;
1758
1759 Qt::Orientations constraints = {};
1760
1761 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X)
1762 constraints |= Qt::Horizontal;
1763 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y)
1764 constraints |= Qt::Vertical;
1765
1766 return constraints;
1767}
1768
1783{
1784 Q_D(const QWaylandXdgPopup);
1785 return d->m_positionerData.offset;
1786}
1787
1800{
1801 Q_D(const QWaylandXdgPopup);
1802 return d->m_positionerData.size;
1803}
1804
1819{
1820 Q_D(const QWaylandXdgPopup);
1821 return d->m_positionerData.unconstrainedPosition();
1822}
1823
1841{
1842 Q_D(QWaylandXdgPopup);
1843 return d->sendConfigure(geometry);
1844}
1845
1860void QWaylandXdgPopup::sendPopupDone()
1861{
1862 Q_D(QWaylandXdgPopup);
1863 d->send_popup_done();
1864}
1865
1870{
1872}
1873
1875 QWaylandXdgPositioner *positioner, const QWaylandResource &resource)
1876 : m_xdgSurface(xdgSurface)
1877 , m_parentXdgSurface(parentXdgSurface)
1878 , m_positionerData(positioner->m_data)
1879{
1880 Q_ASSERT(m_positionerData.isComplete());
1881 init(resource.resource());
1882
1884
1885 //TODO: Need an API for sending a different initial configure
1886 sendConfigure(QRect(m_positionerData.unconstrainedPosition(), m_positionerData.size));
1887}
1888
1890{
1891 Q_Q(QWaylandXdgPopup);
1893 Q_FOREVER {
1894 if (m_pendingConfigures.empty()) {
1895 qWarning("Popup received an unexpected ack_configure!");
1896 return;
1897 }
1898
1899 // This won't work unless there always is a popup.configure for each xdgsurface.configure
1900 config = m_pendingConfigures.takeFirst();
1901
1902 if (config.serial == serial)
1903 break;
1904 }
1905
1906 if (m_geometry == config.geometry)
1907 return;
1908
1909 m_geometry = config.geometry;
1910 emit q->configuredGeometryChanged();
1911}
1912
1913uint QWaylandXdgPopupPrivate::sendConfigure(const QRect &geometry)
1914{
1915 uint32_t serial = m_xdgSurface->surface()->compositor()->nextSerial();
1916 m_pendingConfigures.append(QWaylandXdgPopupPrivate::ConfigureEvent{geometry, serial});
1917 send_configure(geometry.x(), geometry.y(), geometry.width(), geometry.height());
1918 QWaylandXdgSurfacePrivate::get(m_xdgSurface)->send_configure(serial);
1919 return serial;
1920}
1921
1922void QWaylandXdgPopupPrivate::xdg_popup_destroy(QtWaylandServer::xdg_popup::Resource *resource)
1923{
1924 Q_UNUSED(resource);
1925 qWarning() << Q_FUNC_INFO << "Not implemented"; //TODO
1926}
1927
1928void QWaylandXdgPopupPrivate::xdg_popup_grab(QtWaylandServer::xdg_popup::Resource *resource, wl_resource *seat, uint32_t serial)
1929{
1930 Q_UNUSED(resource);
1931 Q_UNUSED(serial);
1932 Q_UNUSED(seat);
1933 qWarning() << Q_FUNC_INFO << "Not implemented"; //TODO
1934 //switch keyboard focus
1935 //eventually send configure with activated.
1936}
1937
1939
1941 : offset(0, 0)
1942{}
1943
1945{
1946 return size.width() > 0 && size.height() > 0 && anchorRect.size().width() > 0 && anchorRect.size().height() > 0;
1947}
1948
1950{
1951 int yPosition = 0;
1953 yPosition = anchorRect.top();
1954 else if (anchorEdges & Qt::BottomEdge)
1955 yPosition = anchorRect.bottom() + 1;
1956 else
1957 yPosition = anchorRect.top() + anchorRect.height() / 2;
1958
1959 int xPosition = 0;
1961 xPosition = anchorRect.left();
1962 else if (anchorEdges & Qt::RightEdge)
1963 xPosition = anchorRect.right() + 1;
1964 else
1965 xPosition = anchorRect.left() + anchorRect.width() / 2;
1966
1967 return QPoint(xPosition, yPosition);
1968}
1969
1971{
1972 int gravityOffsetY = 0;
1974 gravityOffsetY = -size.height();
1975 else if (!(gravityEdges & Qt::BottomEdge))
1976 gravityOffsetY = -size.height() / 2;
1977
1978 int gravityOffsetX = 0;
1980 gravityOffsetX = -size.width();
1981 else if (!(gravityEdges & Qt::RightEdge))
1982 gravityOffsetX = -size.width() / 2;
1983
1984 QPoint gravityOffset(gravityOffsetX, gravityOffsetY);
1985 return anchorPoint() + gravityOffset + offset;
1986}
1987
1989{
1990 init(resource.resource());
1991}
1992
1993void QWaylandXdgPositioner::xdg_positioner_destroy_resource(QtWaylandServer::xdg_positioner::Resource *resource)
1994{
1995 Q_UNUSED(resource);
1996 delete this;
1997}
1998
1999void QWaylandXdgPositioner::xdg_positioner_destroy(QtWaylandServer::xdg_positioner::Resource *resource)
2000{
2001 wl_resource_destroy(resource->handle);
2002}
2003
2004void QWaylandXdgPositioner::xdg_positioner_set_size(QtWaylandServer::xdg_positioner::Resource *resource, int32_t width, int32_t height)
2005{
2006 if (width <= 0 || height <= 0) {
2007 wl_resource_post_error(resource->handle, XDG_POSITIONER_ERROR_INVALID_INPUT,
2008 "xdg_positioner.set_size requested with non-positive dimensions");
2009 return;
2010 }
2011
2013 m_data.size = size;
2014}
2015
2016void QWaylandXdgPositioner::xdg_positioner_set_anchor_rect(QtWaylandServer::xdg_positioner::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
2017{
2018 if (width <= 0 || height <= 0) {
2019 wl_resource_post_error(resource->handle, XDG_POSITIONER_ERROR_INVALID_INPUT,
2020 "xdg_positioner.set_anchor_rect requested with non-positive dimensions");
2021 return;
2022 }
2023
2024 QRect anchorRect(x, y, width, height);
2025 m_data.anchorRect = anchorRect;
2026}
2027
2028void QWaylandXdgPositioner::xdg_positioner_set_anchor(QtWaylandServer::xdg_positioner::Resource *resource, uint32_t anchor)
2029{
2030 Qt::Edges anchorEdges = convertToEdges(xdg_positioner::anchor(anchor));
2031
2032 if ((anchorEdges & Qt::BottomEdge && anchorEdges & Qt::TopEdge) ||
2033 (anchorEdges & Qt::LeftEdge && anchorEdges & Qt::RightEdge)) {
2034 wl_resource_post_error(resource->handle, XDG_POSITIONER_ERROR_INVALID_INPUT,
2035 "xdg_positioner.set_anchor requested with parallel edges");
2036 return;
2037 }
2038
2039 m_data.anchorEdges = anchorEdges;
2040}
2041
2042void QWaylandXdgPositioner::xdg_positioner_set_gravity(QtWaylandServer::xdg_positioner::Resource *resource, uint32_t gravity)
2043{
2044 Qt::Edges gravityEdges = convertToEdges(xdg_positioner::gravity(gravity));
2045
2046 if ((gravityEdges & Qt::BottomEdge && gravityEdges & Qt::TopEdge) ||
2047 (gravityEdges & Qt::LeftEdge && gravityEdges & Qt::RightEdge)) {
2048 wl_resource_post_error(resource->handle, XDG_POSITIONER_ERROR_INVALID_INPUT,
2049 "xdg_positioner.set_gravity requested with parallel edges");
2050 return;
2051 }
2052
2053 m_data.gravityEdges = gravityEdges;
2054}
2055
2056void QWaylandXdgPositioner::xdg_positioner_set_constraint_adjustment(QtWaylandServer::xdg_positioner::Resource *resource, uint32_t constraint_adjustment)
2057{
2058 Q_UNUSED(resource);
2059 m_data.constraintAdjustments = constraint_adjustment;
2060}
2061
2062void QWaylandXdgPositioner::xdg_positioner_set_offset(QtWaylandServer::xdg_positioner::Resource *resource, int32_t x, int32_t y)
2063{
2064 Q_UNUSED(resource);
2065 m_data.offset = QPoint(x, y);
2066}
2067
2069{
2070 return QtWayland::fromResource<QWaylandXdgPositioner *>(resource);
2071}
2072
2074{
2075 switch (anchor) {
2076 case anchor_none:
2077 return Qt::Edges();
2078 case anchor_top:
2079 return Qt::TopEdge;
2080 case anchor_bottom:
2081 return Qt::BottomEdge;
2082 case anchor_left:
2083 return Qt::LeftEdge;
2084 case anchor_right:
2085 return Qt::RightEdge;
2086 case anchor_top_left:
2087 return Qt::TopEdge | Qt::LeftEdge;
2088 case anchor_bottom_left:
2090 case anchor_top_right:
2091 return Qt::TopEdge | Qt::RightEdge;
2092 case anchor_bottom_right:
2094 default:
2095 qWarning() << "Unknown Wayland xdg edge" << anchor;
2096 return Qt::Edges();
2097 }
2098}
2099
2100Qt::Edges QWaylandXdgPositioner::convertToEdges(QWaylandXdgPositioner::gravity gravity)
2101{
2102 return convertToEdges(anchor(gravity));
2103}
2104
2105
2107
2108#include "moc_qwaylandxdgshell.cpp"
NSData * m_data
\inmodule QtCore
Definition qbytearray.h:57
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
Definition qbytearray.h:122
static QByteArray fromRawData(const char *data, qsizetype size)
Constructs a QByteArray that uses the first size bytes of the data array.
Definition qbytearray.h:394
Definition qlist.h:74
bool empty() const noexcept
Definition qlist.h:682
bool removeOne(const AT &t)
Definition qlist.h:581
void push_back(parameter_type t)
Definition qlist.h:672
iterator end()
Definition qlist.h:609
iterator begin()
Definition qlist.h:608
void reserve(qsizetype size)
Definition qlist.h:746
void append(parameter_type t)
Definition qlist.h:441
iterator insert(const Key &key, const T &value)
Definition qmap.h:1425
size_type remove(const Key &key)
Definition qmap.h:944
QList< T > values() const
Definition qmap.h:1078
QObject * parent
Definition qobject.h:61
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore\reentrant
Definition qpoint.h:214
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:333
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:338
\inmodule QtCore\reentrant
Definition qpoint.h:23
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:238
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
Definition qrect.h:181
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:175
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qrect.cpp:851
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:172
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:184
constexpr QSize size() const noexcept
Returns the size of the rectangle.
Definition qrect.h:241
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:235
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:187
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
Definition qrect.h:178
bool remove(const T &value)
Definition qset.h:63
iterator insert(const T &value)
Definition qset.h:155
\inmodule QtCore
Definition qsize.h:207
\inmodule QtCore
Definition qsize.h:25
constexpr QSize boundedTo(const QSize &) const noexcept
Returns a size holding the minimum width and height of this size and the given otherSize.
Definition qsize.h:196
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:132
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:129
constexpr QSize expandedTo(const QSize &) const noexcept
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition qsize.h:191
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
Definition qsize.h:126
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\qmltype WaylandClient \instantiates QWaylandClient \inqmlmodule QtWayland.Compositor
wl_client * client() const
Returns the Wayland client of this QWaylandClient.
void setExtensionContainer(QWaylandObject *container)
Sets the extension container for this QWaylandCompositorExtension to container.
virtual void initialize()
Initializes the QWaylandCompositorExtension.
\qmltype WaylandCompositor \instantiates QWaylandCompositor \inqmlmodule QtWayland....
\qmltype WaylandOutput \instantiates QWaylandOutput \inqmlmodule QtWayland.Compositor
static QWaylandOutput * fromResource(wl_resource *resource)
Returns the QWaylandOutput corresponding to resource.
\qmltype ShellSurfaceItem \instantiates QWaylandQuickShellSurfaceItem \inherits WaylandQuickItem \inq...
\inmodule QtWaylandCompositor
wl_resource * resource() const
\qmltype WaylandSeat \instantiates QWaylandSeat \inqmlmodule QtWayland.Compositor
void keyboardFocusChanged(QWaylandSurface *newFocus, QWaylandSurface *oldFocus)
\qmlsignal void QtWayland.Compositor::WaylandSeat::keyboardFocusChanged(QWaylandSurface newFocus,...
static QWaylandSeat * fromSeatResource(struct ::wl_resource *resource)
Returns the QWaylandSeat corresponding to the resource.
\inmodule QtWaylandCompositor
\inmodule QtWaylandCompositor
const QByteArray name()
Returns the name of the QWaylandSurfaceRole.
\qmltype WaylandSurface \instantiates QWaylandSurface \inqmlmodule QtWayland.Compositor
QSize destinationSize
\qmlproperty size QtWayland.Compositor::WaylandSurface::destinationSize
struct wl_resource * resource() const
Returns the Wayland resource corresponding to this QWaylandSurface.
QWaylandSurfaceRole * role() const
bool hasContent
\qmlproperty bool QtWayland.Compositor::WaylandSurface::hasContent
static QWaylandSurface * fromResource(::wl_resource *resource)
Returns the QWaylandSurface corresponding to the Wayland resource resource.
QWaylandClient * client
\qmlproperty WaylandClient QtWayland.Compositor::WaylandSurface::client
QWaylandCompositor * compositor() const
Returns the compositor for this QWaylandSurface.
bool setRole(QWaylandSurfaceRole *role, wl_resource *errorResource, uint32_t errorCode)
Sets a role on the surface.
void bufferScaleChanged()
void xdg_popup_destroy(Resource *resource) override
QWaylandXdgPopupPrivate(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parentXdgSurface, QWaylandXdgPositioner *positioner, const QWaylandResource &resource)
void xdg_popup_grab(Resource *resource, struct ::wl_resource *seat, uint32_t serial) override
void handleAckConfigure(uint serial)
static QWaylandSurfaceRole s_role
static QWaylandXdgPopupPrivate * get(QWaylandXdgPopup *popup)
\qmltype XdgPopup \instantiates QWaylandXdgPopup \inqmlmodule QtWayland.Compositor....
Qt::Orientations resizeConstraints
\qmlproperty enumeration XdgPopup::resizeConstraints
QRect anchorRect
\qmlproperty rect XdgPopup::anchorRect
QWaylandXdgSurface * parentXdgSurface
\qmlproperty XdgSurface XdgPopup::parentXdgSurface
QSize positionerSize
\qmlproperty size XdgPopup::positionerSize
Qt::Edges gravityEdges
\qmlproperty rect XdgPopup::gravityEdges
QPoint unconstrainedPosition
\qmlproperty point XdgPopup::unconstrainedPosition
Qt::Orientations flipConstraints
\qmlproperty enumeration XdgPopup::flipConstraints
static QWaylandSurfaceRole * role()
Returns the surface role for the QWaylandPopup.
Qt::Orientations slideConstraints
\qmlproperty enumeration XdgPopup::slideConstraints
QRect configuredGeometry
\qmlproperty rect XdgPopup::configuredGeometry
QWaylandXdgSurface * xdgSurface
\qmlproperty XdgSurface XdgPopup::xdgSurface
Qt::Edges anchorEdges
\qmlproperty enumeration XdgPopup::anchorEdges
QPoint offset
\qmlproperty point XdgPopup::offset
Q_INVOKABLE uint sendConfigure(const QRect &geometry)
\qmlmethod int XdgPopup::sendConfigure(rect geometry)
void xdg_positioner_set_gravity(Resource *resource, uint32_t gravity) override
void xdg_positioner_destroy_resource(Resource *resource) override
void xdg_positioner_set_anchor_rect(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override
static QWaylandXdgPositioner * fromResource(wl_resource *resource)
static Qt::Edges convertToEdges(anchor anchor)
QWaylandXdgPositionerData m_data
void xdg_positioner_set_constraint_adjustment(Resource *resource, uint32_t constraint_adjustment) override
void xdg_positioner_set_anchor(Resource *resource, uint32_t anchor) override
void xdg_positioner_set_offset(Resource *resource, int32_t x, int32_t y) override
void xdg_positioner_set_size(Resource *resource, int32_t width, int32_t height) override
QWaylandXdgPositioner(const QWaylandResource &resource)
void xdg_positioner_destroy(Resource *resource) override
static QWaylandXdgShellPrivate * get(QWaylandXdgShell *xdgShell)
void ping(Resource *resource, uint32_t serial)
void unregisterXdgSurface(QWaylandXdgSurface *xdgSurface)
void xdg_wm_base_pong(Resource *resource, uint32_t serial) override
QMultiMap< struct wl_client *, QWaylandXdgSurface * > m_xdgSurfaces
void xdg_wm_base_create_positioner(Resource *resource, uint32_t id) override
void registerXdgSurface(QWaylandXdgSurface *xdgSurface)
QWaylandXdgSurface * xdgSurfaceFromSurface(QWaylandSurface *surface)
void xdg_wm_base_get_xdg_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) override
void xdg_wm_base_destroy(Resource *resource) override
\qmltype XdgShell \instantiates QWaylandXdgShell \inqmlmodule QtWayland.Compositor....
void initialize() override
Initializes the shell extension.
uint ping(QWaylandClient *client)
\qmlmethod void XdgShell::ping(WaylandClient client)
QWaylandXdgShell()
Constructs a QWaylandXdgShell object.
void toplevelCreated(QWaylandXdgToplevel *toplevel, QWaylandXdgSurface *xdgSurface)
\qmlsignal XdgShell::toplevelCreated(XdgToplevel toplevel, XdgSurface xdgSurface)
static QByteArray interfaceName()
static const struct wl_interface * interface()
Returns the Wayland interface for the QWaylandXdgShell.
void popupCreated(QWaylandXdgPopup *popup, QWaylandXdgSurface *xdgSurface)
\qmlsignal XdgShell::popupCreated(XdgPopup popup, XdgSurface xdgSurface)
void setWindowType(Qt::WindowType windowType)
void xdg_surface_get_toplevel(Resource *resource, uint32_t id) override
void xdg_surface_get_popup(Resource *resource, uint32_t id, struct ::wl_resource *parent, struct ::wl_resource *positioner) override
void xdg_surface_ack_configure(Resource *resource, uint32_t serial) override
static QWaylandXdgSurfacePrivate * get(QWaylandXdgSurface *xdgSurface)
QRect calculateFallbackWindowGeometry() const
void xdg_surface_destroy_resource(Resource *resource) override
void xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override
void xdg_surface_destroy(Resource *resource) override
\qmltype XdgSurface \instantiates QWaylandXdgSurface \inqmlmodule QtWayland.Compositor....
QWaylandXdgToplevel * toplevel
\qmlproperty XdgToplevel XdgSurface::toplevel
static QWaylandXdgSurface * fromResource(::wl_resource *resource)
Returns the QWaylandXdgSurface corresponding to the resource.
QWaylandSurface * surface
\qmlproperty WaylandSurface XdgSurface::surface
QRect windowGeometry
\qmlproperty rect XdgSurface::windowGeometry
QWaylandXdgShell * shell
\qmlproperty XdgShell XdgSurface::shell
QWaylandXdgSurface()
Constructs a QWaylandXdgSurface.
void initialize() override
static const struct wl_interface * interface()
Returns the Wayland interface for the QWaylandXdgSurface.
static QByteArray interfaceName()
Qt::WindowType windowType() const override
\qmlproperty enum XdgSurface::windowType
QWaylandXdgPopup * popup
\qmlproperty XdgPopup XdgSurface::popup
void xdg_toplevel_set_min_size(Resource *resource, int32_t width, int32_t height) override
QList< ConfigureEvent > m_pendingConfigures
void xdg_toplevel_unset_fullscreen(Resource *resource) override
void xdg_toplevel_set_max_size(Resource *resource, int32_t width, int32_t height) override
ConfigureEvent lastSentConfigure() const
void xdg_toplevel_move(Resource *resource, struct ::wl_resource *seatResource, uint32_t serial) override
void xdg_toplevel_set_title(Resource *resource, const QString &title) override
void xdg_toplevel_set_fullscreen(Resource *resource, struct ::wl_resource *output) override
QWaylandXdgToplevelDecorationV1 * m_decoration
static QWaylandXdgToplevelPrivate * get(QWaylandXdgToplevel *toplevel)
void xdg_toplevel_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial, uint32_t edges) override
QWaylandXdgSurface * m_xdgSurface
void xdg_toplevel_set_app_id(Resource *resource, const QString &app_id) override
void xdg_toplevel_destroy(Resource *resource) override
QWaylandXdgToplevelPrivate(QWaylandXdgSurface *xdgSurface, const QWaylandResource &resource)
void xdg_toplevel_set_minimized(Resource *resource) override
static Qt::Edges convertToEdges(resize_edge edge)
void xdg_toplevel_show_window_menu(Resource *resource, struct ::wl_resource *seat, uint32_t serial, int32_t x, int32_t y) override
static QWaylandSurfaceRole s_role
QWaylandXdgToplevel * m_parentToplevel
void xdg_toplevel_destroy_resource(Resource *resource) override
void xdg_toplevel_set_parent(Resource *resource, struct ::wl_resource *parent) override
void xdg_toplevel_set_maximized(Resource *resource) override
void xdg_toplevel_unset_maximized(Resource *resource) override
\qmltype XdgToplevel \instantiates QWaylandXdgToplevel \inqmlmodule QtWayland.Compositor....
QWaylandXdgToplevel(QWaylandXdgSurface *xdgSurface, QWaylandResource &resource)
Constructs a QWaylandXdgToplevel for the given xdgSurface and resource.
Q_INVOKABLE void sendClose()
\qmlmethod void XdgToplevel::sendClose()
Q_INVOKABLE uint sendMaximized(const QSize &size)
\qmlmethod void XdgToplevel::sendMaximized(size size)
QString title
\qmlproperty string XdgToplevel::title
Q_INVOKABLE QSize sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const
\qmlmethod size XdgToplevel::sizeForResize(size size, point delta, uint edges)
QSize maxSize
\qmlproperty size XdgToplevel::maxSize
QWaylandXdgToplevel * parentToplevel
\qmlproperty XdgToplevel XdgToplevel::parentToplevel
QString appId
\qmlproperty string XdgToplevel::appId
Q_INVOKABLE uint sendResizing(const QSize &maxSize)
\qmlmethod void XdgToplevel::sendResizing(size maxSize)
bool resizing
\qmlproperty bool XdgToplevel::resizing
uint sendConfigure(const QSize &size, const QList< State > &states)
QWaylandXdgSurface * xdgSurface
\qmlproperty XdgSurface XdgToplevel::xdgSurface
Q_INVOKABLE uint sendUnmaximized(const QSize &size=QSize(0, 0))
\qmlmethod void XdgToplevel::sendUnmaximized(size size)
static QWaylandXdgToplevel * fromResource(::wl_resource *resource)
Returns the QWaylandXdgToplevel corresponding to the resource.
static QWaylandSurfaceRole * role()
Returns the surface role for the QWaylandToplevel.
bool maximized
\qmlproperty bool XdgToplevel::maximized
QSize minSize
\qmlproperty size XdgToplevel::minSize
DecorationMode
This enum type is used to specify the window decoration mode for toplevel windows.
QList< int > states
This property holds the last states the client acknowledged for this QWaylandToplevel.
Q_INVOKABLE uint sendFullscreen(const QSize &size)
\qmlmethod void XdgToplevel::sendFullscreen(size size)
enum DecorationMode decorationMode
\qmlproperty enumeration XdgToplevel::decorationMode
bool activated
\qmlproperty bool XdgToplevel::activated
bool fullscreen
\qmlproperty bool XdgToplevel::fullscreen
else opt state
[0]
Combined button and popup list for selecting options.
@ Horizontal
Definition qnamespace.h:98
@ Vertical
Definition qnamespace.h:99
@ RightEdge
@ TopEdge
@ BottomEdge
@ LeftEdge
WindowType
Definition qnamespace.h:204
@ Popup
Definition qnamespace.h:210
@ Window
Definition qnamespace.h:206
@ SubWindow
Definition qnamespace.h:215
#define Q_UNLIKELY(x)
#define Q_FUNC_INFO
EGLConfig config
#define Q_FOREVER
Definition qforeach.h:70
#define qWarning
Definition qlogging.h:162
#define qCWarning(category,...)
static QOpenGLCompositor * compositor
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei width
GLbitfield flags
GLenum GLuint GLintptr offset
GLint y
GLuint res
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLdouble s
[6]
Definition qopenglext.h:235
GLfloat GLfloat p
[1]
GLuint * states
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
#define emit
#define Q_UNUSED(x)
unsigned int uint
Definition qtypes.h:29
double qreal
Definition qtypes.h:92
QT_BEGIN_NAMESPACE typedef uchar * output
QList< int > list
[14]
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
QString title
[35]
myObject disconnect()
[26]
QGraphicsItem * item
bool contains(const AT &t) const noexcept
Definition qlist.h:44
QList< QWaylandXdgToplevel::State > states
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent