Make addRegistryListener protected
Enables leaf classes that want to bind immediately to call it without waiting for an event loop Change-Id: I4a885959ef54ba12a2c46f3f1a668e8c0cf1d967 Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
8e16ebe3fb
commit
515282115d
@ -71,10 +71,13 @@ void QWaylandClientExtensionPrivate::handleRegistryGlobal(void *data, ::wl_regis
|
||||
}
|
||||
}
|
||||
|
||||
void QWaylandClientExtension::addRegistryListener()
|
||||
void QWaylandClientExtension::initialize()
|
||||
{
|
||||
Q_D(QWaylandClientExtension);
|
||||
d->waylandIntegration->display()->addRegistryListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this);
|
||||
if (!d->registered) {
|
||||
d->waylandIntegration->display()->addRegistryListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this);
|
||||
d->registered = true;
|
||||
}
|
||||
}
|
||||
|
||||
QWaylandClientExtension::QWaylandClientExtension(const int ver)
|
||||
@ -85,7 +88,7 @@ QWaylandClientExtension::QWaylandClientExtension(const int ver)
|
||||
|
||||
// The registry listener uses virtual functions and we don't want it to be called from
|
||||
// the constructor.
|
||||
QMetaObject::invokeMethod(this, "addRegistryListener", Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(this, "initialize", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
QtWaylandClient::QWaylandIntegration *QWaylandClientExtension::integration() const
|
||||
|
@ -76,8 +76,8 @@ Q_SIGNALS:
|
||||
void versionChanged();
|
||||
void activeChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void addRegistryListener();
|
||||
protected Q_SLOTS:
|
||||
void initialize();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
QtWaylandClient::QWaylandIntegration *waylandIntegration = nullptr;
|
||||
int version = -1;
|
||||
bool active = false;
|
||||
bool registered = false;
|
||||
};
|
||||
|
||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate
|
||||
|
Loading…
x
Reference in New Issue
Block a user