diff options
author | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-09-03 12:11:33 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-09-04 16:12:47 +0200 |
commit | c4f2c0479fd992183ce04347111c5968dfd961bc (patch) | |
tree | 357f5d7878373349cee8b093bf1d0f9d9825cda8 /src/compositor/compositor_api/qwaylandcompositor.cpp | |
parent | 5addf79903a9007cfb65ad09e46d2c47f4a2cc37 (diff) |
Add way for classes to get polish events on compositor initiazliation
When the compositor has been created the wl_display and registry has
been initialized. When this is done other globals can be created.
Change-Id: Ifb8a0757877963a35bfa2a896ddb8f28a0b69d64
Diffstat (limited to 'src/compositor/compositor_api/qwaylandcompositor.cpp')
-rw-r--r-- | src/compositor/compositor_api/qwaylandcompositor.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index 5ee27e71b..cc8c2ba4e 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -189,6 +189,13 @@ void QWaylandCompositorPrivate::init() initializeDefaultInputDevice(); initialized = true; + + Q_FOREACH (QPointer<QObject> object, polish_objects) { + if (object) { + QEvent polishEvent(QEvent::Polish); + QCoreApplication::sendEvent(object.data(), &polishEvent); + } + } } QWaylandCompositorPrivate::~QWaylandCompositorPrivate() @@ -225,6 +232,15 @@ void QWaylandCompositorPrivate::feedRetainedSelectionData(QMimeData *data) q->retainedSelectionReceived(data); } +void QWaylandCompositorPrivate::addPolishObject(QObject *object) +{ + if (initialized) { + QCoreApplication::postEvent(object, new QEvent(QEvent::Polish)); + } else { + polish_objects.append(object); + } +} + void QWaylandCompositorPrivate::compositor_create_surface(Resource *resource, uint32_t id) { Q_Q(QWaylandCompositor); |