summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/qwaylanddisplay.cpp28
-rw-r--r--src/client/qwaylanddisplay_p.h12
2 files changed, 32 insertions, 8 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index ec439b5d..0b715c0a 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -175,12 +175,6 @@ QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const
return 0;
}
-void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data)
-{
- Listener l = { listener, data };
- mRegistryListeners.append(l);
-}
-
void QWaylandDisplay::waitForScreens()
{
flushRequests();
@@ -234,13 +228,33 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
} else if (interface == QStringLiteral("wl_text_input_manager")) {
mTextInputManager.reset(new QtWayland::wl_text_input_manager(registry, id));
} else if (interface == QStringLiteral("qt_hardware_integration")) {
- mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id));
+ mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id));
}
+ mGlobals.append(RegistryGlobal(id, interface, version, registry));
+
foreach (Listener l, mRegistryListeners)
(*l.listener)(l.data, registry, id, interface, version);
}
+void QWaylandDisplay::registry_global_remove(uint32_t id)
+{
+ for (int i = 0, ie = mGlobals.count(); i != ie; ++i) {
+ if (mGlobals[i].id == id) {
+ mGlobals.removeAt(i);
+ break;
+ }
+ }
+}
+
+void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data)
+{
+ Listener l = { listener, data };
+ mRegistryListeners.append(l);
+ for (int i = 0, ie = mGlobals.count(); i != ie; ++i)
+ (*l.listener)(l.data, mGlobals[i].registry, mGlobals[i].id, mGlobals[i].interface, mGlobals[i].version);
+}
+
uint32_t QWaylandDisplay::currentTimeMillisec()
{
//### we throw away the time information
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index 5ba4f51b..40cb2b2c 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -130,6 +130,15 @@ public:
QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager.data(); }
QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); }
+ struct RegistryGlobal {
+ uint32_t id;
+ QString interface;
+ uint32_t version;
+ struct ::wl_registry *registry;
+ RegistryGlobal(uint32_t id_, const QString &interface_, uint32_t version_, struct ::wl_registry *registry_)
+ : id(id_), interface(interface_), version(version_), registry(registry_) { }
+ };
+
/* wl_registry_add_listener does not add but rather sets a listener, so this function is used
* to enable many listeners at once. */
void addRegistryListener(RegistryListener listener, void *data);
@@ -173,13 +182,14 @@ private:
QScopedPointer<QWaylandWindowManagerIntegration> mWindowManagerIntegration;
QScopedPointer<QtWayland::wl_text_input_manager> mTextInputManager;
QScopedPointer<QWaylandHardwareIntegration> mHardwareIntegration;
-
QSocketNotifier *mReadNotifier;
int mFd;
int mWritableNotificationFd;
bool mScreensInitialized;
+ QList<RegistryGlobal> mGlobals;
void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE;
+ void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE;
static void shellHandleConfigure(void *data, struct wl_shell *shell,
uint32_t time, uint32_t edges,