Clean integration of mirclient API into a client's event loop.

Registered by Chris Halse Rogers

Currently we handle events by executing callbacks passed in to the mirclient API on some library thread. Many client or their toolkits have their own event loop, and this is unnecessarily hard for them to integrate.

Let's fix that.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Chris Halse Rogers
Direction:
Needs approval
Assignee:
Chris Halse Rogers
Definition:
Approved
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

What GTK would like is a fd to select() on; when it becomes readable the glib mainloop would call something like mir_client_read_event(...).

This ideally comes with the ability to set a userptr associated with particular objects - MirSurface, etc.

For now, since we need a dispatch-based model for async results anyway, we will just
dispatch the events in the usual way (via callback), but from the main thread (from mir_connection_dispatch_events() or so) instead of in a thread.

(?)

Work Items

Work items:
Provide an "int mir_connect_with_mainloop_fd(socket, appname, usrptr)" that returns an fd that becomes readable when events are available and otherwise does no event dispatch: TODO
Add a mir_connection_dispatch_events(MirConnection, MirClientEvent*) API: TODO

This blueprint contains Public information 
Everyone can see this information.