Bump Weston library dependencies to work with Weston 11.0.0.
The following changes are needed to port the compositor to the
latest changes from libweston 11.
Specifically we now use weston_surface_unref() instead of
weston_surface_destroy(). The weston_head parameter is now needed
when creating an output in weston_compositor_create_output().
We now use weston_buffer_create_solid_rgba() instead of
weston_surface_set_color() to create our black curtain. A further
upstream updates has been added to include some of the shell-utils
wrapper but we'll get those in the next release of libweston.
Finally, in order to attach heads and enable the outputs, we need to
start from 1, rather than 0, and we now need lazy output placement for
multiple outputs, following basically what weston is doing.
Bug-AGL: SPEC-4578
Bug-AGL: SPEC-4617
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ie4aa7bc09b99d85b6bda49437c5f4789012244e1
)
config_h = configuration_data()
-libweston_version = 'libweston-10'
+libweston_version = 'libweston-11'
pkgconfig = import('pkgconfig')
fs = import('fs')
dependency('wayland-server'),
dependency('weston'),
libweston_dep,
- dependency('libweston-desktop-10'),
+ dependency('libweston-desktop-11'),
]
if (output->fullscreen_view.fs &&
output->fullscreen_view.fs->view) {
- weston_surface_destroy(output->fullscreen_view.fs->view->surface);
+ weston_surface_unref(output->fullscreen_view.fs->view->surface);
+ weston_buffer_destroy_solid(output->fullscreen_view.buffer_ref);
output->fullscreen_view.fs->view = NULL;
}
{
size_t fail_len = 0;
- for (size_t i = 0; i < output->add_len; ++i) {
+ for (size_t i = 1; i < output->add_len; i++) {
if (weston_output_attach_head(output->output, output->add[i]) < 0) {
struct weston_head *tmp = output->add[i];
memmove(&output->add[fail_len + 1], output->add[fail_len],
return fail_len;
}
+/* Place output exactly to the right of the most recently enabled output.
+ *
+ * Historically, we haven't given much thought to output placement,
+ * simply adding outputs in a horizontal line as they're enabled. This
+ * function simply sets an output's x coordinate to the right of the
+ * most recently enabled output, and its y to zero.
+ *
+ * If you're adding new calls to this function, you're also not giving
+ * much thought to output placement, so please consider carefully if
+ * it's really doing what you want.
+ *
+ * You especially don't want to use this for any code that won't
+ * immediately enable the passed output.
+ */
+static void
+weston_output_lazy_align(struct weston_output *output)
+{
+ struct weston_compositor *c;
+ struct weston_output *peer;
+ int next_x = 0;
+
+ /* Put this output to the right of the most recently enabled output */
+ c = output->compositor;
+ if (!wl_list_empty(&c->output_list)) {
+ peer = container_of(c->output_list.prev,
+ struct weston_output, link);
+ next_x = peer->x + peer->width;
+ }
+ output->x = next_x;
+ output->y = 0;
+}
+
+
/*
* Like try_attach_heads, this reorganizes the output's add array into a failed
* and successful section.
for (; i < output->add_len; ++i) {
struct weston_head *head;
+ weston_output_lazy_align(output->output);
+
if (weston_output_enable(output->output) == 0)
break;
struct fullscreen_view {
struct ivi_surface *fs;
struct wl_listener fs_destroy;
+ struct weston_buffer_reference *buffer_ref;
} fullscreen_view;
struct wl_listener output_destroy;
struct weston_output *output =
weston_head_from_resource(output_resource)->output;
struct weston_buffer *buffer =
- weston_buffer_from_resource(buffer_resource);
+ weston_buffer_from_resource(output->compositor, buffer_resource);
if (buffer == NULL) {
wl_resource_post_no_memory(resource);
wl_list_for_each(output, &ivi->outputs, link) {
if (output->fullscreen_view.fs &&
output->fullscreen_view.fs->view) {
- weston_surface_destroy(output->fullscreen_view.fs->view->surface);
+ weston_surface_unref(output->fullscreen_view.fs->view->surface);
output->fullscreen_view.fs->view = NULL;
}
}
}
+int
+curtain_get_label(struct weston_surface *surface, char *buf, size_t len)
+{
+ return snprintf(buf, len, "%s", "black curtain");
+}
+
+static void
+curtain_surface_committed(struct weston_surface *es, int32_t sx, int32_t sy)
+{
+
+}
+
+
static void
create_black_curtain_view(struct ivi_output *output)
{
struct weston_surface *surface = NULL;
struct weston_view *view;
struct ivi_compositor *ivi = output->ivi;
- struct weston_compositor *wc= ivi->compositor;
+ struct weston_compositor *ec = ivi->compositor;
struct weston_output *woutput = output->output;
+ struct weston_buffer_reference *buffer_ref;
if (!woutput)
return;
- surface = weston_surface_create(wc);
+ surface = weston_surface_create(ec);
if (!surface)
return;
+
view = weston_view_create(surface);
- if (!view) {
- weston_surface_destroy(surface);
- return;
- }
+ if (!view)
+ goto err_surface;
+
+ buffer_ref = weston_buffer_create_solid_rgba(ec, 0.0, 0.0, 0.0, 1.0);
+ if (buffer_ref == NULL)
+ goto err_view;
- weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1);
+ surface->committed = curtain_surface_committed;
+ surface->committed_private = NULL;
weston_surface_set_size(surface, woutput->width, woutput->height);
+
+ weston_surface_attach_solid(surface, buffer_ref,
+ woutput->width, woutput->height);
+
+ weston_surface_set_label_func(surface, curtain_get_label);
weston_view_set_position(view, woutput->x, woutput->y);
output->fullscreen_view.fs = zalloc(sizeof(struct ivi_surface));
- if (!output->fullscreen_view.fs) {
- weston_surface_destroy(surface);
- return;
- }
+ if (!output->fullscreen_view.fs)
+ goto err_view;
+
output->fullscreen_view.fs->view = view;
+ output->fullscreen_view.buffer_ref = buffer_ref;
- output->fullscreen_view.fs_destroy.notify = destroy_black_curtain_view;
+ output->fullscreen_view.fs_destroy.notify =
+ destroy_black_curtain_view;
wl_signal_add(&woutput->destroy_signal,
&output->fullscreen_view.fs_destroy);
+
+ return;
+
+err_view:
+ weston_view_destroy(view);
+err_surface:
+ weston_surface_unref(surface);
}
bool