KWayland
6 #include "compositor.h"
7 #include "event_queue.h"
10 #include "wayland_pointer_p.h"
12 #include <QGuiApplication>
14 #include <qpa/qplatformnativeinterface.h>
16 #include <wayland-client-protocol.h>
22 class Q_DECL_HIDDEN Compositor::Private
27 WaylandPointer<wl_compositor, wl_compositor_destroy> compositor;
28 EventQueue *queue =
nullptr;
37 Compositor::~Compositor()
44 QPlatformNativeInterface *native = qApp->platformNativeInterface();
48 wl_compositor *compositor =
reinterpret_cast<wl_compositor *
>(native->nativeResourceForIntegration(QByteArrayLiteral(
"compositor")));
53 c->d->compositor.setup(compositor,
true);
60 Q_ASSERT(!d->compositor);
61 d->compositor.setup(compositor);
66 d->compositor.release();
71 d->compositor.destroy();
88 auto w = wl_compositor_create_surface(d->compositor);
90 d->queue->addProxy(w);
105 auto w = wl_compositor_create_region(d->compositor);
107 d->queue->addProxy(w);
115 return std::unique_ptr<Region>(
createRegion(region,
nullptr));
118 Compositor::operator wl_compositor *()
120 return d->compositor;
123 Compositor::operator wl_compositor *()
const
125 return d->compositor;
130 return d->compositor.isValid();
void destroy()
Destroys the data held by this Compositor.
Wrapper for the wl_surface interface.
void setup(wl_region *region)
Setup this Surface to manage the region.
Wrapper class for wl_event_queue interface.
Surface * createSurface(QObject *parent=nullptr)
Creates and setup a new Surface with parent.
EventQueue * eventQueue()
void setup(wl_surface *surface)
Setup this Surface to manage the surface.
void setup(wl_compositor *compositor)
Setup this Compositor to manage the compositor.
void setEventQueue(EventQueue *queue)
Sets the queue to use for creating a Surface.
Region * createRegion(QObject *parent=nullptr)
Creates and setup a new Region with parent.
Compositor(QObject *parent=nullptr)
Creates a new Compositor.
Wrapper for the wl_compositor interface.
void release()
Releases the wl_compositor interface.
QObject * parent() const const
static Compositor * fromApplication(QObject *parent=nullptr)
Creates a Compositor for the used QGuiApplication.
Wrapper for the wl_region interface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Jan 30 2023 03:56:23 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.