libweston: add heads_changed_signal
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Tue, 15 Aug 2017 10:00:02 +0000 (13:00 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 12 Apr 2018 12:12:39 +0000 (15:12 +0300)
commit37e6c9e5372cc244f7a09a7cce9c4a5c29b13e23
treeba75f7fd98307a66ed407d351a92306d33d092df
parent1adcbacd5bc737fb639bcc292dad7a6867bac2f4
libweston: add heads_changed_signal

Add a hook for compositors to get a callback when heads are added or
their connection status changes, to which compositors likely want to
react to by enabling or disabling outputs (API for that to be added
later).

As many head changes as possible should be coalesced into a single
heads_changed call. Therefore the callback is made from an idle task.
This anticipates a future atomic output configuration API, where the
global output configuration is tested and set atomically instead of one
by one.

weston_pending_output_coldplug() needs to manually execute the
heads_changed call so that initial outputs are created before any
plugins get their start-up idle tasks ran. This is especially important
for ivi-shell which does not support output hotplug, and for tests to
guarantee the expected outputs.

v8:
- Change the callback function pointer into a wl_signal. The API is
  changed and renamed.

v6:
- fix a typo
- add comment in weston_pending_output_coldplug()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v6 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
v6 Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
libweston/compositor.c
libweston/compositor.h