diff options
author | Giulio Camuffo <giuliocamuffo@gmail.com> | 2015-05-06 21:41:57 +0300 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2015-05-08 14:09:02 -0700 |
commit | b114715dae4b8899ce0bc4fb13f98b4c0f4f1896 (patch) | |
tree | 006f469db77fd0491a5ba27bbbbdcfc970b4b1d7 /src/compositor.c | |
parent | 22f343017560764e82d63535fbf5617d999a4038 (diff) | |
download | weston-b114715dae4b8899ce0bc4fb13f98b4c0f4f1896.tar.gz |
compositor: send the output_created signal after inserting it in the list
The compositor's output_created signal used to be sent in weston_output_init()
which the backend call before putting the output in the output_list.
This caused problems when creating a new view in a listener to that signal,
because weston_view_assign_output() doesn't yet know the new output exists.
To fix this add a new weston_composito_add_output() func which adds the
output in the list and later sends the signal, and make the backends call
that.
Diffstat (limited to 'src/compositor.c')
-rw-r--r-- | src/compositor.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/compositor.c b/src/compositor.c index 698ee520..8f02b4de 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -4125,7 +4125,20 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c, output->global = wl_global_create(c->wl_display, &wl_output_interface, 2, output, bind_output); - wl_signal_emit(&c->output_created_signal, output); +} + +/** Adds an output to the compositor's output list and + * send the compositor's output_created signal. + * + * \param compositor The compositor instance. + * \param output The output to be added. + */ +WL_EXPORT void +weston_compositor_add_output(struct weston_compositor *compositor, + struct weston_output *output) +{ + wl_list_insert(compositor->output_list.prev, &output->link); + wl_signal_emit(&compositor->output_created_signal, output); } WL_EXPORT void |