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.
dev
Giulio Camuffo 10 years ago committed by Bryce Harrington
parent 22f3430175
commit b114715dae
  1. 2
      src/compositor-drm.c
  2. 2
      src/compositor-fbdev.c
  3. 2
      src/compositor-headless.c
  4. 2
      src/compositor-rdp.c
  5. 2
      src/compositor-rpi.c
  6. 2
      src/compositor-wayland.c
  7. 2
      src/compositor-x11.c
  8. 15
      src/compositor.c
  9. 3
      src/compositor.h

@ -2125,7 +2125,7 @@ create_output_for_connector(struct drm_compositor *ec,
weston_log("Failed to initialize backlight\n");
}
wl_list_insert(ec->base.output_list.prev, &output->base.link);
weston_compositor_add_output(&ec->base, &output->base);
find_and_parse_output_edid(ec, output, connector);
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)

@ -581,7 +581,7 @@ fbdev_output_create(struct fbdev_compositor *compositor,
output->finish_frame_timer =
wl_event_loop_add_timer(loop, finish_frame_handler, output);
wl_list_insert(compositor->base.output_list.prev, &output->base.link);
weston_compositor_add_output(&compositor->base, &output->base);
weston_log("fbdev output %d×%d px\n",
output->mode.width, output->mode.height);

@ -169,7 +169,7 @@ headless_compositor_create_output(struct headless_compositor *c,
output->image);
}
wl_list_insert(c->base.output_list.prev, &output->base.link);
weston_compositor_add_output(&c->base, &output->base);
return 0;
}

@ -488,7 +488,7 @@ rdp_compositor_create_output(struct rdp_compositor *c, int width, int height)
output->base.switch_mode = rdp_switch_mode;
c->output = output;
wl_list_insert(c->base.output_list.prev, &output->base.link);
weston_compositor_add_output(&c->base, &output->base);
return 0;
out_shadow_surface:

@ -357,7 +357,7 @@ rpi_output_create(struct rpi_compositor *compositor, uint32_t transform)
if (rpi_renderer_output_create(&output->base, output->display) < 0)
goto out_output;
wl_list_insert(compositor->base.output_list.prev, &output->base.link);
weston_compositor_add_output(&compositor->base, &output->base);
weston_log("Raspberry Pi HDMI output %dx%d px\n",
output->mode.width, output->mode.height);

@ -1057,7 +1057,7 @@ wayland_output_create(struct wayland_compositor *c, int x, int y,
output->base.set_dpms = NULL;
output->base.switch_mode = wayland_output_switch_mode;
wl_list_insert(c->base.output_list.prev, &output->base.link);
weston_compositor_add_output(&c->base, &output->base);
return output;

@ -915,7 +915,7 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
output->finish_frame_timer =
wl_event_loop_add_timer(loop, finish_frame_handler, output);
wl_list_insert(c->base.output_list.prev, &output->base.link);
weston_compositor_add_output(&c->base, &output->base);
weston_log("x11 output %dx%d, window id %d\n",
width, height, output->window);

@ -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

@ -1374,6 +1374,9 @@ void
weston_output_init(struct weston_output *output, struct weston_compositor *c,
int x, int y, int width, int height, uint32_t transform, int32_t scale);
void
weston_compositor_add_output(struct weston_compositor *compositor,
struct weston_output *output);
void
weston_output_destroy(struct weston_output *output);
void
weston_output_transform_coordinate(struct weston_output *output,

Loading…
Cancel
Save