Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <Registry.h>
Public Types | |
using | AddHandler = std::function<void(std::uint32_t , wayland::proxy_t&& )> |
using | RemoveHandler = std::function<void(std::uint32_t) > |
Public Member Functions | |
CRegistry (CConnection &connection) | |
template<typename T> | |
void | RequestSingleton (T &target, std::uint32_t minVersion, std::uint32_t maxVersion, bool required=true) |
template<typename T> | |
void | Request (std::uint32_t minVersion, std::uint32_t maxVersion, const AddHandler &addHandler, const RemoveHandler &removeHandler) |
void | Bind () |
void | UnbindSingletons () |
Handle Wayland globals
Request singletons (bound once) with RequestSingleton, non-singletons such as wl_output with Request, then call Bind once.
Make sure to destroy all registries before destroying the CConnection.
using KODI::WINDOWING::WAYLAND::CRegistry::AddHandler = std::function<void(std::uint32_t , wayland::proxy_t&& )> |
using KODI::WINDOWING::WAYLAND::CRegistry::RemoveHandler = std::function<void(std::uint32_t) > |
|
explicit |
void CRegistry::Bind | ( | ) |
Create a registry object at the compositor and do an roundtrip to bind objects
This function blocks until the initial roundtrip is complete. All statically requested singletons that were available will be bound then.
Neither statically nor dynamically requested proxies will be bound before this function is called.
May throw std::runtime_error if a required global was not found.
Can only be called once for the same CRegistry object.
|
inline |
Request a callback when a dynamic global appears or disappears
The callbacks may be called from the thread that calls Bind or the global Wayland message pump thread during Bind (but never at the same time) and only from the global thread after Bind returns.
Events that occur immediately upon binding are only delivered reliably if Bind is called from the Wayland message pump thread.
Cannot be called after Bind has been called.
minVersion | minimum version to bind |
maxVersion | maximum version to bind |
addHandler | function that is called when a global of the requested type is added |
removeHandler | function that is called when a global of the requested type is removed |
|
inline |
Request a static singleton global to be bound to a proxy
You should only use this if the singleton is announced at registry bind time (not dynamically) and you do not need to catch events that are sent immediately in response to the bind. Use Request in that case, even if there is ever only one instance of the object at maximum.
Cannot be called after Bind has been called.
target | target of waylandpp proxy type |
minVersion | minimum version to bind |
maxVersion | maximum version to bind |
required | whether to throw an exception when the bind cannot be satisfied by the compositor - exception is thrown in Bind |
void CRegistry::UnbindSingletons | ( | ) |
Unbind all singletons requested with RequestSingleton