Send the globals to new listeners
Change-Id: I8d2a74cdc305fb086f3b5c63d0abe4c46c40bbde Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
This commit is contained in:
parent
3a2ece17c3
commit
cb09f9a7fa
@ -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();
|
||||
@ -237,10 +231,30 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
||||
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
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user