1// Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include <QWaylandCompositor>
5#include <QWaylandOutput>
6
7#include "qwaylandquickxdgoutputv1.h"
8#include "qwaylandxdgoutputv1_p.h"
9
10QT_BEGIN_NAMESPACE
11
12QWaylandQuickXdgOutputV1::QWaylandQuickXdgOutputV1()
13 : QWaylandXdgOutputV1()
14{
15}
16
17void QWaylandQuickXdgOutputV1::componentComplete()
18{
19 // Try to find the manager from the compositor extensions
20 if (!manager()) {
21 for (auto *p = parent(); p != nullptr; p = p->parent()) {
22 if (auto *c = qobject_cast<QWaylandCompositor *>(object: p)) {
23 for (auto *extension : c->extensions()) {
24 if (auto *m = qobject_cast<QWaylandXdgOutputManagerV1 *>(object: extension)) {
25 QWaylandXdgOutputV1Private::get(xdgOutput: this)->setManager(m);
26 break;
27 }
28 }
29 }
30 }
31 }
32
33 // Try to find the output from the parents
34 if (!output()) {
35 for (auto *p = parent(); p != nullptr; p = p->parent()) {
36 if (auto *o = qobject_cast<QWaylandOutput *>(object: p)) {
37 QWaylandXdgOutputV1Private::get(xdgOutput: this)->setOutput(o);
38 break;
39 }
40 }
41 }
42}
43
44QT_END_NAMESPACE
45
46#include "moc_qwaylandquickxdgoutputv1.cpp"
47

source code of qtwayland/src/compositor/extensions/qwaylandquickxdgoutputv1.cpp