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.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)
9#endif
10#include <QtWaylandCompositor/private/qwaylandutils_p.h>
11
13
14#include <QtWaylandCompositor/QWaylandCompositor>
15#include <QtWaylandCompositor/QWaylandSeat>
16#include <QtWaylandCompositor/QWaylandSurface>
17#include <QtWaylandCompositor/QWaylandSurfaceRole>
18#include <QtWaylandCompositor/QWaylandResource>
19
20#include <QtCore/QObject>
21
22#include <algorithm>
23
25
29
30void QWaylandXdgShellPrivate::ping(QtWaylandServer::xdg_wm_base::Resource *resource, uint32_t serial)
31{
32 m_pings.insert(serial);
33 send_ping(resource->handle, serial);
34}
35
37{
38 m_xdgSurfaces.insert(xdgSurface->surface()->client()->client(), xdgSurface);
39}
40
42{
43 auto xdgSurfacePrivate = QWaylandXdgSurfacePrivate::get(xdgSurface);
44 if (!m_xdgSurfaces.remove(xdgSurfacePrivate->resource()->client(), xdgSurface))
45 qWarning("%s Unexpected state. Can't find registered xdg surface\n", Q_FUNC_INFO);
46}
47
49{
50 for (QWaylandXdgSurface *xdgSurface : std::as_const(m_xdgSurfaces)) {
51 if (surface == xdgSurface->surface())
52 return xdgSurface;
53 }
54 return nullptr;
55}
56
58{
59 if (!m_xdgSurfaces.values(resource->client()).empty())
60 wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_DEFUNCT_SURFACES,
61 "xdg_shell was destroyed before children");
62
63 wl_resource_destroy(resource->handle);
64}
65
66void QWaylandXdgShellPrivate::xdg_wm_base_create_positioner(QtWaylandServer::xdg_wm_base::Resource *resource, uint32_t id)
67{
68 QWaylandResource positionerResource(wl_resource_create(resource->client(), &xdg_positioner_interface,
69 wl_resource_get_version(resource->handle), id));
70
71 new QWaylandXdgPositioner(positionerResource);
72}
73
74void QWaylandXdgShellPrivate::xdg_wm_base_get_xdg_surface(Resource *resource, uint32_t id, wl_resource *surfaceResource)
75{
77 QWaylandSurface *surface = QWaylandSurface::fromResource(surfaceResource);
78
79 if (surface->role() != nullptr) {
80 wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_ROLE,
81 "wl_surface@%d, already has role %s\n",
82 wl_resource_get_id(surface->resource()),
83 surface->role()->name().constData());
84 return;
85 }
86
87 if (surface->hasContent()) {
88 //TODO: According to the spec, this is a client error, but there's no appropriate error code
89 qWarning() << "get_xdg_surface requested on a xdg_surface with content";
90 }
91
92 QWaylandResource xdgSurfaceResource(wl_resource_create(resource->client(), &xdg_surface_interface,
93 wl_resource_get_version(resource->handle), id));
94
95 QWaylandXdgSurface *xdgSurface = new QWaylandXdgSurface(q, surface, xdgSurfaceResource);
96
97 registerXdgSurface(xdgSurface);
98 emit q->xdgSurfaceCreated(xdgSurface);
99}
100
101void QWaylandXdgShellPrivate::xdg_wm_base_pong(Resource *resource, uint32_t serial)
102{
103 Q_UNUSED(resource);
104 Q_Q(QWaylandXdgShell);
105 if (m_pings.remove(serial))
106 emit q->pong(serial);
107 else
108 qWarning("Received an unexpected pong!");
109}
110
159
167
172{
173 Q_D(QWaylandXdgShell);
176 if (!compositor) {
177 qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandXdgShell";
178 return;
179 }
180 d->init(compositor->display(), 1);
181
182 handleSeatChanged(compositor->defaultSeat(), nullptr);
183
184 connect(compositor, &QWaylandCompositor::defaultSeatChanged,
185 this, &QWaylandXdgShell::handleSeatChanged);
186
187 // Support the dialog extension unconditionally.
188 QObject *dialogExtension = new QWaylandXdgDialogV1Global(compositor);
189 dialogExtension->setParent(this);
190}
191
195const struct wl_interface *QWaylandXdgShell::interface()
196{
197 return QWaylandXdgShellPrivate::interface();
198}
199
201{
202 return QWaylandXdgShellPrivate::interfaceName();
203}
204
217{
218 Q_D(QWaylandXdgShell);
219
222
223 uint32_t serial = compositor->nextSerial();
224
225 QWaylandXdgShellPrivate::Resource *clientResource = d->resourceMap().value(client->client(), nullptr);
226 Q_ASSERT(clientResource);
227
228 d->ping(clientResource, serial);
229 return serial;
230}
231
232void QWaylandXdgShell::handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat)
233{
234 if (oldSeat != nullptr) {
236 this, &QWaylandXdgShell::handleFocusChanged);
237 }
238
239 if (newSeat != nullptr) {
241 this, &QWaylandXdgShell::handleFocusChanged);
242 }
243}
244
245void QWaylandXdgShell::handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface)
246{
247 Q_D(QWaylandXdgShell);
248
249 QWaylandXdgSurface *newXdgSurface = d->xdgSurfaceFromSurface(newSurface);
250 QWaylandXdgSurface *oldXdgSurface = d->xdgSurfaceFromSurface(oldSurface);
251
252 if (newXdgSurface)
253 QWaylandXdgSurfacePrivate::get(newXdgSurface)->handleFocusReceived();
254
255 if (oldXdgSurface)
256 QWaylandXdgSurfacePrivate::get(oldXdgSurface)->handleFocusLost();
257}
258
262
264{
265 if (m_windowType == windowType)
266 return;
267
268 m_windowType = windowType;
269
271 emit q->windowTypeChanged();
272}
273
275{
276 if (m_toplevel)
277 QWaylandXdgToplevelPrivate::get(m_toplevel)->handleFocusLost();
278}
279
281{
282 if (m_toplevel)
283 QWaylandXdgToplevelPrivate::get(m_toplevel)->handleFocusReceived();
284}
285
287{
288 // TODO: The unset window geometry should include subsurfaces as well, so this solution
289 // won't work too well on those kinds of clients.
290 return QRect(QPoint(), m_surface->destinationSize());
291}
292
294{
296 if (!m_unsetWindowGeometry)
297 return;
298
299 const QRect unsetGeometry = calculateFallbackWindowGeometry();
300 if (unsetGeometry == m_windowGeometry)
301 return;
302
303 m_windowGeometry = unsetGeometry;
304 emit q->windowGeometryChanged();
305}
306
307void QWaylandXdgSurfacePrivate::xdg_surface_destroy_resource(QtWaylandServer::xdg_surface::Resource *resource)
308{
309 Q_UNUSED(resource);
311 QWaylandXdgShellPrivate::get(m_xdgShell)->unregisterXdgSurface(q);
312 delete q;
313}
314
315void QWaylandXdgSurfacePrivate::xdg_surface_destroy(QtWaylandServer::xdg_surface::Resource *resource)
316{
317 wl_resource_destroy(resource->handle);
318}
319
320void QWaylandXdgSurfacePrivate::xdg_surface_get_toplevel(QtWaylandServer::xdg_surface::Resource *resource, uint32_t id)
321{
323
324 if (m_toplevel || m_popup) {
325 wl_resource_post_error(resource->handle, XDG_SURFACE_ERROR_ALREADY_CONSTRUCTED,
326 "xdg_surface already has a role object");
327 return;
328 }
329
330 if (!m_surface->setRole(QWaylandXdgToplevel::role(), resource->handle, XDG_WM_BASE_ERROR_ROLE))
331 return;
332
333 QWaylandResource topLevelResource(wl_resource_create(resource->client(), &xdg_toplevel_interface,
334 wl_resource_get_version(resource->handle), id));
335
336 m_toplevel = new QWaylandXdgToplevel(q, topLevelResource);
337 emit q->toplevelCreated();
338 emit m_xdgShell->toplevelCreated(m_toplevel, q);
339 q->connect(m_toplevel, &QWaylandXdgToplevel::modalChanged, q, [q, this](){
340 q->setModal(m_toplevel->modal());
341 });
342}
343
344void QWaylandXdgSurfacePrivate::xdg_surface_get_popup(QtWaylandServer::xdg_surface::Resource *resource, uint32_t id, wl_resource *parentResource, wl_resource *positionerResource)
345{
347
348 if (m_toplevel || m_popup) {
349 wl_resource_post_error(resource->handle, XDG_SURFACE_ERROR_ALREADY_CONSTRUCTED,
350 "xdg_surface already has a role object");
351 return;
352 }
353
355 if (!parent) {
356 wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT,
357 "xdg_surface.get_popup with invalid popup parent");
358 return;
359 }
360
361 QWaylandXdgPositioner *positioner = QWaylandXdgPositioner::fromResource(positionerResource);
362 if (!positioner) {
363 wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_INVALID_POSITIONER,
364 "xdg_surface.get_popup without positioner");
365 return;
366 }
367
368 if (!positioner->m_data.isComplete()) {
369 QWaylandXdgPositionerData p = positioner->m_data;
370 wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_INVALID_POSITIONER,
371 "xdg_surface.get_popup with invalid positioner (size: %dx%d, anchorRect: %dx%d)",
372 p.size.width(), p.size.height(), p.anchorRect.width(), p.anchorRect.height());
373 return;
374 }
375
376 QRect anchorBounds(QPoint(0, 0), parent->windowGeometry().size());
377 if (!anchorBounds.contains(positioner->m_data.anchorRect)) {
378 // TODO: this is a protocol error and should ideally be handled like this:
379 //wl_resource_post_error(resource->handle, XDG_WM_BASE_ERROR_INVALID_POSITIONER,
380 // "xdg_positioner anchor rect extends beyound its parent's window geometry");
381 //return;
382 // However, our own clients currently do this, so we'll settle for a gentle warning instead.
383 qCWarning(qLcWaylandCompositor) << "Ignoring client protocol error: xdg_positioner anchor"
384 << "rect extends beyond its parent's window geometry";
385 }
386
387 if (!m_surface->setRole(QWaylandXdgPopup::role(), resource->handle, XDG_WM_BASE_ERROR_ROLE))
388 return;
389
390 QWaylandResource popupResource(wl_resource_create(resource->client(), &xdg_popup_interface,
391 wl_resource_get_version(resource->handle), id));
392
393 m_popup = new QWaylandXdgPopup(q, parent, positioner, popupResource);
394 emit q->popupCreated();
395 emit m_xdgShell->popupCreated(m_popup, q);
396}
397
398void QWaylandXdgSurfacePrivate::xdg_surface_ack_configure(QtWaylandServer::xdg_surface::Resource *resource, uint32_t serial)
399{
400 if (m_toplevel) {
401 QWaylandXdgToplevelPrivate::get(m_toplevel)->handleAckConfigure(serial);
402 } else if (m_popup) {
403 QWaylandXdgPopupPrivate::get(m_popup)->handleAckConfigure(serial);
404 } else {
405 wl_resource_post_error(resource->handle, XDG_SURFACE_ERROR_NOT_CONSTRUCTED,
406 "ack_configure requested on an unconstructed xdg_surface");
407 }
408}
409
410void QWaylandXdgSurfacePrivate::xdg_surface_set_window_geometry(QtWaylandServer::xdg_surface::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
411{
413
414 if (!q->surface()->role()) {
415 wl_resource_post_error(resource->handle, XDG_SURFACE_ERROR_NOT_CONSTRUCTED,
416 "set_window_geometry requested on an unconstructed xdg_surface");
417 return;
418 }
419
420 if (width <= 0 || height <= 0) {
421 // The protocol spec says "setting an invalid size will raise an error". But doesn't tell
422 // which error to raise, and there's no fitting error in the xdg_surface_error enum.
423 // So until this is fixed, just output a warning and return.
424 qWarning() << "Invalid (non-positive) dimensions received in set_window_geometry";
425 return;
426 }
427
428 m_unsetWindowGeometry = false;
429
430 QRect geometry(x, y, width, height);
431
432 if (m_windowGeometry == geometry)
433 return;
434
435 m_windowGeometry = geometry;
436 emit q->windowGeometryChanged();
437}
438
475
485
498{
500 d->m_xdgShell = xdgShell;
501 d->m_surface = surface;
502 d->init(resource.resource());
504 d->m_windowGeometry = d->calculateFallbackWindowGeometry();
505 connect(surface, &QWaylandSurface::destinationSizeChanged, this, &QWaylandXdgSurface::handleSurfaceSizeChanged);
506 connect(surface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandXdgSurface::handleBufferScaleChanged);
510}
511
518{
519 Q_D(const QWaylandXdgSurface);
520 return d->m_windowType;
521}
522
543{
544 Q_D(const QWaylandXdgSurface);
545 return d->m_windowGeometry;
546}
547
555
556void QWaylandXdgSurface::handleSurfaceSizeChanged()
557{
559 d->updateFallbackWindowGeometry();
560}
561
562void QWaylandXdgSurface::handleBufferScaleChanged()
563{
565 d->updateFallbackWindowGeometry();
566}
567
580{
581 Q_D(const QWaylandXdgSurface);
582 return d->m_xdgShell;
583}
584
597{
598 Q_D(const QWaylandXdgSurface);
599 return d->m_surface;
600}
601
620{
621 Q_D(const QWaylandXdgSurface);
622 return d->m_toplevel;
623}
624
643{
644 Q_D(const QWaylandXdgSurface);
645 return d->m_popup;
646}
647
651const wl_interface *QWaylandXdgSurface::interface()
652{
653 return QWaylandXdgSurfacePrivate::interface();
654}
655
660{
661 return QWaylandXdgSurfacePrivate::interfaceName();
662}
663
668{
669 if (auto p = QtWayland::fromResource<QWaylandXdgSurfacePrivate *>(resource))
670 return p->q_func();
671 return nullptr;
672}
673
674#if QT_CONFIG(wayland_compositor_quick)
675QWaylandQuickShellIntegration *QWaylandXdgSurface::createIntegration(QWaylandQuickShellSurfaceItem *item)
676{
677 Q_D(const QWaylandXdgSurface);
678
679 if (d->m_toplevel)
681
682 if (d->m_popup)
684
685 return nullptr;
686}
687#endif
688
720 : QObject(*new QWaylandXdgToplevelPrivate(xdgSurface, resource))
721{
722 QList<QWaylandXdgToplevel::State> states;
723 sendConfigure({0, 0}, states);
724}
725
727{
729 // Usually, the decoration is destroyed by the client (according to the protocol),
730 // but if the client misbehaves, or is shut down, we need to clean up here.
731 if (Q_UNLIKELY(d->m_decoration))
732 wl_resource_destroy(d->m_decoration->resource()->handle);
733 Q_ASSERT(!d->m_decoration);
734}
735
748{
749 Q_D(const QWaylandXdgToplevel);
750 return d->m_xdgSurface;
751}
752
766{
767 Q_D(const QWaylandXdgToplevel);
768 return d->m_parentToplevel;
769}
770
783{
784 Q_D(const QWaylandXdgToplevel);
785 return d->m_title;
786}
787
800{
801 Q_D(const QWaylandXdgToplevel);
802 return d->m_appId;
803}
804
821{
822 Q_D(const QWaylandXdgToplevel);
823 return d->m_maxSize;
824}
825
842{
843 Q_D(const QWaylandXdgToplevel);
844 return d->m_minSize;
845}
846
852QList<QWaylandXdgToplevel::State> QWaylandXdgToplevel::states() const
853{
854 Q_D(const QWaylandXdgToplevel);
855 return d->m_lastAckedConfigure.states;
856}
857
870{
871 Q_D(const QWaylandXdgToplevel);
872 return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevel::State::MaximizedState);
873}
874
887{
888 Q_D(const QWaylandXdgToplevel);
889 return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevel::State::FullscreenState);
890}
891
904{
905 Q_D(const QWaylandXdgToplevel);
906 return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevel::State::ResizingState);
907}
908
921{
922 Q_D(const QWaylandXdgToplevel);
923 return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevel::State::ActivatedState);
924}
925
940{
941 Q_D(const QWaylandXdgToplevel);
942 return d->m_modal;
943}
944
945void QWaylandXdgToplevel::setModal(bool newModal)
946{
948 if (d->m_modal == newModal)
949 return;
950 d->m_modal = newModal;
952}
953
983{
984 Q_D(const QWaylandXdgToplevel);
985 return d->m_decoration ? d->m_decoration->configuredMode() : DecorationMode::ClientSideDecoration;
986}
987
999QSize QWaylandXdgToplevel::sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const
1000{
1001 qreal width = size.width();
1002 qreal height = size.height();
1003 if (edges & Qt::LeftEdge)
1004 width -= delta.x();
1005 else if (edges & Qt::RightEdge)
1006 width += delta.x();
1007
1008 if (edges & Qt::TopEdge)
1009 height -= delta.y();
1010 else if (edges & Qt::BottomEdge)
1011 height += delta.y();
1012
1013 QSize newSize = QSize(width, height)
1015 .expandedTo({1, 1}); // We don't want to send a size of (0,0) as that means that the client decides
1016
1017 if (maxSize().isValid())
1018 newSize = newSize.boundedTo(maxSize());
1019
1020 return newSize;
1021}
1022
1028uint QWaylandXdgToplevel::sendConfigure(const QSize &size, const QList<QWaylandXdgToplevel::State> &states)
1029{
1030 if (!size.isValid()) {
1031 qWarning() << "Can't configure xdg_toplevel with an invalid size" << size;
1032 return 0;
1033 }
1035 auto statesBytes = QByteArray::fromRawData(reinterpret_cast<const char *>(states.data()),
1036 states.size() * static_cast<int>(sizeof(State)));
1037 uint32_t serial = d->m_xdgSurface->surface()->compositor()->nextSerial();
1038 d->m_pendingConfigures.append(QWaylandXdgToplevelPrivate::ConfigureEvent{states, size, serial});
1039 d->send_configure(size.width(), size.height(), statesBytes);
1040 QWaylandXdgSurfacePrivate::get(d->m_xdgSurface)->send_configure(serial);
1041 return serial;
1042}
1043
1052{
1053 QList<State> s;
1054 for (auto state : states)
1055 s << State(state);
1056 return sendConfigure(size, s);
1057}
1058
1069{
1071 d->send_close();
1072}
1073
1090{
1092 QWaylandXdgToplevelPrivate::ConfigureEvent conf = d->lastSentConfigure();
1093
1094 if (!conf.states.contains(QWaylandXdgToplevel::State::MaximizedState))
1096 conf.states.removeOne(QWaylandXdgToplevel::State::FullscreenState);
1097 conf.states.removeOne(QWaylandXdgToplevel::State::ResizingState);
1098
1099 return sendConfigure(size, conf.states);
1100}
1101
1120{
1122 QWaylandXdgToplevelPrivate::ConfigureEvent conf = d->lastSentConfigure();
1123
1125 conf.states.removeOne(QWaylandXdgToplevel::State::FullscreenState);
1126 conf.states.removeOne(QWaylandXdgToplevel::State::ResizingState);
1127
1128 return sendConfigure(size, conf.states);
1129
1130}
1131
1152{
1154 QWaylandXdgToplevelPrivate::ConfigureEvent conf = d->lastSentConfigure();
1155
1156 if (!conf.states.contains(QWaylandXdgToplevel::State::FullscreenState))
1158 conf.states.removeOne(QWaylandXdgToplevel::State::MaximizedState);
1159 conf.states.removeOne(QWaylandXdgToplevel::State::ResizingState);
1160
1161 return sendConfigure(size, conf.states);
1162}
1163
1180{
1182 QWaylandXdgToplevelPrivate::ConfigureEvent conf = d->lastSentConfigure();
1183
1184 if (!conf.states.contains(QWaylandXdgToplevel::State::ResizingState))
1186 conf.states.removeOne(QWaylandXdgToplevel::State::MaximizedState);
1187 conf.states.removeOne(QWaylandXdgToplevel::State::FullscreenState);
1188
1189 return sendConfigure(maxSize, conf.states);
1190}
1191
1199
1204{
1205 if (auto p = QtWayland::fromResource<QWaylandXdgToplevelPrivate *>(resource))
1206 return p->q_func();
1207 return nullptr;
1208}
1209
1286QList<int> QWaylandXdgToplevel::statesAsInts() const
1287{
1288 QList<int> list;
1289 const auto s = states();
1290 list.reserve(s.size());
1291 for (auto state : s) {
1292 list << static_cast<int>(state);
1293 }
1294 return list;
1295}
1296
1298
1300 : m_xdgSurface(xdgSurface)
1301{
1302 init(resource.resource());
1303}
1304
1306{
1309 Q_FOREVER {
1310 if (m_pendingConfigures.empty()) {
1311 qWarning("Toplevel received an unexpected ack_configure!");
1312 return;
1313 }
1314
1315 // This won't work unless there always is a toplevel.configure for each xdgsurface.configure
1316 config = m_pendingConfigures.takeFirst();
1317
1318 if (config.serial == serial)
1319 break;
1320 }
1321
1322 QList<uint> changedStates;
1323 std::set_symmetric_difference(
1325 config.states.begin(), config.states.end(),
1326 std::back_inserter(changedStates));
1327
1329
1330 for (uint state : changedStates) {
1331 switch (state) {
1332 case state_maximized:
1333 emit q->maximizedChanged();
1334 break;
1335 case state_fullscreen:
1336 emit q->fullscreenChanged();
1337 break;
1338 case state_resizing:
1339 emit q->resizingChanged();
1340 break;
1341 case state_activated:
1342 emit q->activatedChanged();
1343 break;
1344 }
1345 }
1346
1347 if (!changedStates.empty())
1348 emit q->statesChanged();
1349}
1350
1358
1368
1370{
1371 return Qt::Edges(((edge & 0b1100) >> 1) | ((edge & 0b0010) << 2) | (edge & 0b0001));
1372}
1373
1374void QWaylandXdgToplevelPrivate::xdg_toplevel_destroy_resource(QtWaylandServer::xdg_toplevel::Resource *resource)
1375{
1376 Q_UNUSED(resource);
1378 delete q;
1379}
1380
1381void QWaylandXdgToplevelPrivate::xdg_toplevel_destroy(QtWaylandServer::xdg_toplevel::Resource *resource)
1382{
1384 qWarning() << "Client error: xdg_toplevel destroyed before its decoration object";
1385
1386 wl_resource_destroy(resource->handle);
1387 //TODO: Should the xdg surface be desroyed as well? Or is it allowed to recreate a new toplevel for it?
1388}
1389
1390void QWaylandXdgToplevelPrivate::xdg_toplevel_set_parent(QtWaylandServer::xdg_toplevel::Resource *resource, wl_resource *parent)
1391{
1392 Q_UNUSED(resource);
1394
1396
1397 if (m_parentToplevel != parentToplevel) {
1398 m_parentToplevel = parentToplevel;
1399 emit q->parentToplevelChanged();
1400 }
1401
1403 // There's a parent now, which means the surface is transient
1406 // When the surface has no parent it is toplevel
1408 }
1409}
1410
1411void QWaylandXdgToplevelPrivate::xdg_toplevel_set_title(QtWaylandServer::xdg_toplevel::Resource *resource, const QString &title)
1412{
1413 Q_UNUSED(resource);
1414 if (title == m_title)
1415 return;
1417 m_title = title;
1418 emit q->titleChanged();
1419}
1420
1421void QWaylandXdgToplevelPrivate::xdg_toplevel_set_app_id(QtWaylandServer::xdg_toplevel::Resource *resource, const QString &app_id)
1422{
1423 Q_UNUSED(resource);
1424 if (app_id == m_appId)
1425 return;
1427 m_appId = app_id;
1428 emit q->appIdChanged();
1429}
1430
1431void QWaylandXdgToplevelPrivate::xdg_toplevel_show_window_menu(QtWaylandServer::xdg_toplevel::Resource *resource, wl_resource *seatResource, uint32_t serial, int32_t x, int32_t y)
1432{
1433 Q_UNUSED(resource);
1434 Q_UNUSED(serial);
1435 QPoint position(x, y);
1436 auto seat = QWaylandSeat::fromSeatResource(seatResource);
1438 emit q->showWindowMenu(seat, position);
1439}
1440
1441void QWaylandXdgToplevelPrivate::xdg_toplevel_move(Resource *resource, wl_resource *seatResource, uint32_t serial)
1442{
1443 Q_UNUSED(resource);
1444 Q_UNUSED(serial);
1446 QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
1447 emit q->startMove(seat);
1448}
1449
1450void QWaylandXdgToplevelPrivate::xdg_toplevel_resize(QtWaylandServer::xdg_toplevel::Resource *resource, wl_resource *seatResource, uint32_t serial, uint32_t edges)
1451{
1452 Q_UNUSED(resource);
1453 Q_UNUSED(serial);
1455 QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
1456 emit q->startResize(seat, convertToEdges(resize_edge(edges)));
1457}
1458
1459void QWaylandXdgToplevelPrivate::xdg_toplevel_set_max_size(QtWaylandServer::xdg_toplevel::Resource *resource, int32_t width, int32_t height)
1460{
1461 Q_UNUSED(resource);
1462
1463 QSize maxSize(width, height);
1464 if (width == 0 && height == 0)
1465 maxSize = QSize(); // Wayland size of zero means unspecified which best translates to invalid
1466
1467 if (m_maxSize == maxSize)
1468 return;
1469
1470 if (width < 0 || height < 0) {
1471 // The spec says raise a protocol error, but there's no matching error defined
1472 qWarning() << "Received a xdg_toplevel.set_max_size request with a negative size";
1473 return;
1474 }
1475
1476 if (m_minSize.isValid() && maxSize.isValid() &&
1477 (maxSize.width() < m_minSize.width() || maxSize.height() < m_minSize.height())) {
1478 // The spec says raise a protocol error, but there's no matching error defined
1479 qWarning() << "Received a xdg_toplevel.set_max_size request with a size smaller than the minimium size";
1480 return;
1481 }
1482
1483 m_maxSize = maxSize;
1484
1486 emit q->maxSizeChanged();
1487}
1488
1489void QWaylandXdgToplevelPrivate::xdg_toplevel_set_min_size(QtWaylandServer::xdg_toplevel::Resource *resource, int32_t width, int32_t height)
1490{
1491 Q_UNUSED(resource);
1492
1493 QSize minSize(width, height);
1494 if (width == 0 && height == 0)
1495 minSize = QSize(); // Wayland size of zero means unspecified
1496
1497 if (m_minSize == minSize)
1498 return;
1499
1500 if (width < 0 || height < 0) {
1501 // The spec says raise a protocol error, but there's no matching error defined
1502 qWarning() << "Received a xdg_toplevel.set_min_size request with a negative size";
1503 return;
1504 }
1505
1506 if (m_maxSize.isValid() && minSize.isValid() &&
1507 (minSize.width() > m_maxSize.width() || minSize.height() > m_maxSize.height())) {
1508 // The spec says raise a protocol error, but there's no matching error defined
1509 qWarning() << "Received a xdg_toplevel.set_min_size request with a size larger than the maximum size";
1510 return;
1511 }
1512
1513 m_minSize = minSize;
1514
1516 emit q->minSizeChanged();
1517}
1518
1519void QWaylandXdgToplevelPrivate::xdg_toplevel_set_maximized(QtWaylandServer::xdg_toplevel::Resource *resource)
1520{
1521 Q_UNUSED(resource);
1523 emit q->setMaximized();
1524}
1525
1526void QWaylandXdgToplevelPrivate::xdg_toplevel_unset_maximized(QtWaylandServer::xdg_toplevel::Resource *resource)
1527{
1528 Q_UNUSED(resource);
1530 emit q->unsetMaximized();
1531}
1532
1533void QWaylandXdgToplevelPrivate::xdg_toplevel_set_fullscreen(QtWaylandServer::xdg_toplevel::Resource *resource, wl_resource *output_res)
1534{
1535 Q_UNUSED(resource);
1537 QWaylandOutput *output = output_res ? QWaylandOutput::fromResource(output_res) : nullptr;
1538 emit q->setFullscreen(output);
1539}
1540
1541void QWaylandXdgToplevelPrivate::xdg_toplevel_unset_fullscreen(QtWaylandServer::xdg_toplevel::Resource *resource)
1542{
1543 Q_UNUSED(resource);
1545 emit q->unsetFullscreen();
1546}
1547
1548void QWaylandXdgToplevelPrivate::xdg_toplevel_set_minimized(QtWaylandServer::xdg_toplevel::Resource *resource)
1549{
1550 Q_UNUSED(resource);
1552 emit q->setMinimized();
1553}
1554
1585QWaylandXdgPopup::QWaylandXdgPopup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parentXdgSurface,
1586 QWaylandXdgPositioner *positioner, QWaylandResource &resource)
1587 : QObject(*new QWaylandXdgPopupPrivate(xdgSurface, parentXdgSurface, positioner, resource))
1588{
1589}
1590
1603{
1604 Q_D(const QWaylandXdgPopup);
1605 return d->m_xdgSurface;
1606}
1607
1621{
1622 Q_D(const QWaylandXdgPopup);
1623 return d->m_parentXdgSurface;
1624}
1625
1640{
1641 Q_D(const QWaylandXdgPopup);
1642 return d->m_geometry;
1643}
1644
1659{
1660 Q_D(const QWaylandXdgPopup);
1661 return d->m_positionerData.anchorRect;
1662}
1663
1686{
1687 Q_D(const QWaylandXdgPopup);
1688 return d->m_positionerData.anchorEdges;
1689}
1690
1711{
1712 Q_D(const QWaylandXdgPopup);
1713 return d->m_positionerData.gravityEdges;
1714}
1715
1732{
1733 Q_D(const QWaylandXdgPopup);
1734 const uint flags = d->m_positionerData.constraintAdjustments;
1735
1736 Qt::Orientations constraints = {};
1737
1738 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X)
1739 constraints |= Qt::Horizontal;
1740 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y)
1741 constraints |= Qt::Vertical;
1742
1743 return constraints;
1744}
1745
1762{
1763 Q_D(const QWaylandXdgPopup);
1764 const uint flags = d->m_positionerData.constraintAdjustments;
1765
1766 Qt::Orientations constraints = {};
1767
1768 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X)
1769 constraints |= Qt::Horizontal;
1770 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y)
1771 constraints |= Qt::Vertical;
1772
1773 return constraints;
1774}
1775
1792{
1793 Q_D(const QWaylandXdgPopup);
1794 const uint flags = d->m_positionerData.constraintAdjustments;
1795
1796 Qt::Orientations constraints = {};
1797
1798 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X)
1799 constraints |= Qt::Horizontal;
1800 if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y)
1801 constraints |= Qt::Vertical;
1802
1803 return constraints;
1804}
1805
1820{
1821 Q_D(const QWaylandXdgPopup);
1822 return d->m_positionerData.offset;
1823}
1824
1837{
1838 Q_D(const QWaylandXdgPopup);
1839 return d->m_positionerData.size;
1840}
1841
1856{
1857 Q_D(const QWaylandXdgPopup);
1858 return d->m_positionerData.unconstrainedPosition();
1859}
1860
1878{
1879 Q_D(QWaylandXdgPopup);
1880 return d->sendConfigure(geometry);
1881}
1882
1897void QWaylandXdgPopup::sendPopupDone()
1898{
1899 Q_D(QWaylandXdgPopup);
1900 d->send_popup_done();
1901}
1902
1910
1912 QWaylandXdgPositioner *positioner, const QWaylandResource &resource)
1913 : m_xdgSurface(xdgSurface)
1914 , m_parentXdgSurface(parentXdgSurface)
1915 , m_positionerData(positioner->m_data)
1916{
1917 Q_ASSERT(m_positionerData.isComplete());
1918 init(resource.resource());
1919
1920 QWaylandXdgSurfacePrivate::get(m_xdgSurface)->setWindowType(Qt::WindowType::Popup);
1921
1922 //TODO: Need an API for sending a different initial configure
1923 sendConfigure(QRect(m_positionerData.unconstrainedPosition(), m_positionerData.size));
1924}
1925
1927{
1928 Q_Q(QWaylandXdgPopup);
1930 Q_FOREVER {
1931 if (m_pendingConfigures.empty()) {
1932 qWarning("Popup received an unexpected ack_configure!");
1933 return;
1934 }
1935
1936 // This won't work unless there always is a popup.configure for each xdgsurface.configure
1937 config = m_pendingConfigures.takeFirst();
1938
1939 if (config.serial == serial)
1940 break;
1941 }
1942
1943 if (m_geometry == config.geometry)
1944 return;
1945
1946 m_geometry = config.geometry;
1947 emit q->configuredGeometryChanged();
1948}
1949
1950uint QWaylandXdgPopupPrivate::sendConfigure(const QRect &geometry)
1951{
1952 uint32_t serial = m_xdgSurface->surface()->compositor()->nextSerial();
1953 m_pendingConfigures.append(QWaylandXdgPopupPrivate::ConfigureEvent{geometry, serial});
1954 send_configure(geometry.x(), geometry.y(), geometry.width(), geometry.height());
1955 QWaylandXdgSurfacePrivate::get(m_xdgSurface)->send_configure(serial);
1956 return serial;
1957}
1958
1959void QWaylandXdgPopupPrivate::xdg_popup_destroy(QtWaylandServer::xdg_popup::Resource *resource)
1960{
1961 Q_UNUSED(resource);
1962 qWarning() << Q_FUNC_INFO << "Not implemented"; //TODO
1963}
1964
1965void QWaylandXdgPopupPrivate::xdg_popup_grab(QtWaylandServer::xdg_popup::Resource *resource, wl_resource *seat, uint32_t serial)
1966{
1967 Q_UNUSED(resource);
1968 Q_UNUSED(serial);
1969 Q_UNUSED(seat);
1970 qWarning() << Q_FUNC_INFO << "Not implemented"; //TODO
1971 //switch keyboard focus
1972 //eventually send configure with activated.
1973}
1974
1976
1980
1982{
1983 return size.width() > 0 && size.height() > 0 && anchorRect.size().width() > 0 && anchorRect.size().height() > 0;
1984}
1985
1987{
1988 int yPosition = 0;
1990 yPosition = anchorRect.top();
1991 else if (anchorEdges & Qt::BottomEdge)
1992 yPosition = anchorRect.bottom() + 1;
1993 else
1994 yPosition = anchorRect.top() + anchorRect.height() / 2;
1995
1996 int xPosition = 0;
1998 xPosition = anchorRect.left();
1999 else if (anchorEdges & Qt::RightEdge)
2000 xPosition = anchorRect.right() + 1;
2001 else
2002 xPosition = anchorRect.left() + anchorRect.width() / 2;
2003
2004 return QPoint(xPosition, yPosition);
2005}
2006
2008{
2009 int gravityOffsetY = 0;
2011 gravityOffsetY = -size.height();
2012 else if (!(gravityEdges & Qt::BottomEdge))
2013 gravityOffsetY = -size.height() / 2;
2014
2015 int gravityOffsetX = 0;
2017 gravityOffsetX = -size.width();
2018 else if (!(gravityEdges & Qt::RightEdge))
2019 gravityOffsetX = -size.width() / 2;
2020
2021 QPoint gravityOffset(gravityOffsetX, gravityOffsetY);
2022 return anchorPoint() + gravityOffset + offset;
2023}
2024
2029
2030void QWaylandXdgPositioner::xdg_positioner_destroy_resource(QtWaylandServer::xdg_positioner::Resource *resource)
2031{
2032 Q_UNUSED(resource);
2033 delete this;
2034}
2035
2036void QWaylandXdgPositioner::xdg_positioner_destroy(QtWaylandServer::xdg_positioner::Resource *resource)
2037{
2038 wl_resource_destroy(resource->handle);
2039}
2040
2041void QWaylandXdgPositioner::xdg_positioner_set_size(QtWaylandServer::xdg_positioner::Resource *resource, int32_t width, int32_t height)
2042{
2043 if (width <= 0 || height <= 0) {
2044 wl_resource_post_error(resource->handle, XDG_POSITIONER_ERROR_INVALID_INPUT,
2045 "xdg_positioner.set_size requested with non-positive dimensions");
2046 return;
2047 }
2048
2050 m_data.size = size;
2051}
2052
2053void QWaylandXdgPositioner::xdg_positioner_set_anchor_rect(QtWaylandServer::xdg_positioner::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
2054{
2055 if (width <= 0 || height <= 0) {
2056 wl_resource_post_error(resource->handle, XDG_POSITIONER_ERROR_INVALID_INPUT,
2057 "xdg_positioner.set_anchor_rect requested with non-positive dimensions");
2058 return;
2059 }
2060
2061 QRect anchorRect(x, y, width, height);
2062 m_data.anchorRect = anchorRect;
2063}
2064
2065void QWaylandXdgPositioner::xdg_positioner_set_anchor(QtWaylandServer::xdg_positioner::Resource *resource, uint32_t anchor)
2066{
2067 Qt::Edges anchorEdges = convertToEdges(xdg_positioner::anchor(anchor));
2068
2069 if ((anchorEdges & Qt::BottomEdge && anchorEdges & Qt::TopEdge) ||
2070 (anchorEdges & Qt::LeftEdge && anchorEdges & Qt::RightEdge)) {
2071 wl_resource_post_error(resource->handle, XDG_POSITIONER_ERROR_INVALID_INPUT,
2072 "xdg_positioner.set_anchor requested with parallel edges");
2073 return;
2074 }
2075
2076 m_data.anchorEdges = anchorEdges;
2077}
2078
2079void QWaylandXdgPositioner::xdg_positioner_set_gravity(QtWaylandServer::xdg_positioner::Resource *resource, uint32_t gravity)
2080{
2081 Qt::Edges gravityEdges = convertToEdges(xdg_positioner::gravity(gravity));
2082
2083 if ((gravityEdges & Qt::BottomEdge && gravityEdges & Qt::TopEdge) ||
2084 (gravityEdges & Qt::LeftEdge && gravityEdges & Qt::RightEdge)) {
2085 wl_resource_post_error(resource->handle, XDG_POSITIONER_ERROR_INVALID_INPUT,
2086 "xdg_positioner.set_gravity requested with parallel edges");
2087 return;
2088 }
2089
2090 m_data.gravityEdges = gravityEdges;
2091}
2092
2093void QWaylandXdgPositioner::xdg_positioner_set_constraint_adjustment(QtWaylandServer::xdg_positioner::Resource *resource, uint32_t constraint_adjustment)
2094{
2095 Q_UNUSED(resource);
2096 m_data.constraintAdjustments = constraint_adjustment;
2097}
2098
2099void QWaylandXdgPositioner::xdg_positioner_set_offset(QtWaylandServer::xdg_positioner::Resource *resource, int32_t x, int32_t y)
2100{
2101 Q_UNUSED(resource);
2102 m_data.offset = QPoint(x, y);
2103}
2104
2106{
2107 return QtWayland::fromResource<QWaylandXdgPositioner *>(resource);
2108}
2109
2111{
2112 switch (anchor) {
2113 case anchor_none:
2114 return Qt::Edges();
2115 case anchor_top:
2116 return Qt::TopEdge;
2117 case anchor_bottom:
2118 return Qt::BottomEdge;
2119 case anchor_left:
2120 return Qt::LeftEdge;
2121 case anchor_right:
2122 return Qt::RightEdge;
2123 case anchor_top_left:
2124 return Qt::TopEdge | Qt::LeftEdge;
2125 case anchor_bottom_left:
2127 case anchor_top_right:
2128 return Qt::TopEdge | Qt::RightEdge;
2129 case anchor_bottom_right:
2131 default:
2132 qWarning() << "Unknown Wayland xdg edge" << anchor;
2133 return Qt::Edges();
2134 }
2135}
2136
2137Qt::Edges QWaylandXdgPositioner::convertToEdges(QWaylandXdgPositioner::gravity gravity)
2138{
2139 return convertToEdges(anchor(gravity));
2140}
2141
2142
2144
2145#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:124
static QByteArray fromRawData(const char *data, qsizetype size)
Constructs a QByteArray that uses the first size bytes of the data array.
Definition qbytearray.h:409
bool removeOne(const AT &t)
Definition qlist.h:598
void push_back(parameter_type t)
Definition qlist.h:675
iterator end()
Definition qlist.h:626
iterator begin()
Definition qlist.h:625
void reserve(qsizetype size)
Definition qlist.h:753
void append(parameter_type t)
Definition qlist.h:458
iterator insert(const Key &key, const T &value)
Definition qmap.h:1452
size_type remove(const Key &key)
Definition qmap.h:971
QList< T > values() const
Definition qmap.h:1105
QObject * parent
Definition qobject.h:73
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qpoint.h:217
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:343
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:348
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:239
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
Definition qrect.h:182
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:176
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:173
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:185
constexpr QSize size() const noexcept
Returns the size of the rectangle.
Definition qrect.h:242
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:236
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:188
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
Definition qrect.h:179
bool remove(const T &value)
Definition qset.h:63
iterator insert(const T &value)
Definition qset.h:155
\inmodule QtCore
Definition qsize.h:208
\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:197
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:130
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:192
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:127
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\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
bool modal
\qmlproperty bool XdgToplevel::modal
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:99
@ Vertical
Definition qnamespace.h:100
@ RightEdge
@ TopEdge
@ BottomEdge
@ LeftEdge
WindowType
Definition qnamespace.h:205
@ Popup
Definition qnamespace.h:211
@ Window
Definition qnamespace.h:207
@ SubWindow
Definition qnamespace.h:216
#define Q_UNLIKELY(x)
#define Q_FUNC_INFO
EGLConfig config
#define Q_FOREVER
Definition qforeach.h:70
#define qWarning
Definition qlogging.h:166
#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
GLdouble s
[6]
Definition qopenglext.h:235
GLuint res
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
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:34
double qreal
Definition qtypes.h:187
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:45
QList< QWaylandXdgToplevel::State > states