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
qwaylandshellintegration_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 Jolla Ltd
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWAYLANDSHELLINTEGRATION_H
5#define QWAYLANDSHELLINTEGRATION_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWaylandClient/qtwaylandclientglobal.h>
19#include <QtWaylandClient/qwaylandclientextension.h>
20
21
22
23#include <QDebug>
24#include <private/qglobal_p.h>
25
26struct wl_surface;
27struct wl_registry;
28
30
31class QWindow;
32
33namespace QtWaylandClient {
34
35class QWaylandWindow;
36class QWaylandDisplay;
38
39class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegration
40{
41public:
44
47 virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) {
48 Q_UNUSED(resource);
50 return nullptr;
51 }
52
53 static wl_surface *wlSurfaceForWindow(QWaylandWindow *window);
54
55};
56
57template <typename T>
59{
60public:
65
66 bool initialize(QWaylandDisplay *) override
67 {
69 return isActive();
70 }
71
72 const struct wl_interface *extensionInterface() const override
73 {
74 return T::interface();
75 }
76
77 void bind(struct ::wl_registry *registry, int id, int ver) override
78 {
79 T* instance = static_cast<T *>(this);
80 // Make sure lowest version is used of the supplied version from the
81 // developer and the version specified in the protocol and also the
82 // compositor version.
83 if (this->version() > T::interface()->version) {
84 qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher than the version of the protocol, using protocol version instead.");
85 }
86 int minVersion = qMin(ver, qMin(T::interface()->version, this->version()));
87 setVersion(minVersion);
88 instance->init(registry, id, minVersion);
89 }
90};
91
92
93}
94
96
97#endif // QWAYLANDSHELLINTEGRATION_H
bool isActive
\inmodule QtCore
Definition qbytearray.h:57
\qmltype ShellSurface \instantiates QWaylandShellSurface \inqmlmodule QtWayland.Compositor
\inmodule QtGui
Definition qwindow.h:63
const struct wl_interface * extensionInterface() const override
void bind(struct ::wl_registry *registry, int id, int ver) override
virtual bool initialize(QWaylandDisplay *display)=0
virtual QWaylandShellSurface * createShellSurface(QWaylandWindow *window)=0
virtual void * nativeResourceForWindow(const QByteArray &resource, QWindow *window)
format setVersion(3, 2)
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
#define qWarning
Definition qlogging.h:166
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
#define Q_UNUSED(x)
aWidget window() -> setWindowTitle("New Window Title")
[2]