Class StartupInternalClient

Class Documentation

class StartupInternalClient

Wrapper for running an internal Mir client at startup.

Param client_code:

code implementing the internal client

Param connection_notification:

handler for registering the server-side application Wraps an internal client such that it runs at startup and does not need to be launched with the miral::InternalClientLauncher.

Note

client_code will be executed on its own thread, this must exit

Note

connection_notification will be called on a worker thread and must not block

Public Functions

explicit StartupInternalClient(std::function<void(struct ::wl_display *display)> client_code, std::function<void(std::weak_ptr<mir::scene::Session> const session)> connect_notification)

Construct an internal client to be launched when the Mir server starts.

The connect_notification call will be called when a connection to the server has been secured. This is called on a worker thread and must not block.

The client_code callback will be called when the client has been initialized and is ready to start interacting with the server. Note that this callback happens on another thread. This callback must exit.

Parameters:
  • client_code – called when the Wayland client is initialized

  • connect_notification – called when the session has connected

template<typename ClientObject>
inline explicit StartupInternalClient(ClientObject const &client_object)

Construct an internal client to be launched when the Mir server starts.

The client_object instance must define:

  • operator()(struct wl_display*) - the method called when the client has been initialized and is ready to start interacting with the server. Note that this callback happens in another thread. This callback must exit.

  • operator()(std::weak_ptr<mir::scene::Session> const) - the method called when a connection to the server has been secured. This is called on a worker thread and must not block.

Parameters:

client_object – an object describing the client connection

~StartupInternalClient()
void operator()(mir::Server &server)