X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=inline;f=src%2Fcompositor.c;h=c38fb1cebcd0ee8dc7a3a3e94807af3c85a2227c;hb=5921beed9208e15fa45c4bb719f667cdd50cd94c;hp=2c8c386cb2182ad9a3069998c4bda59ce0d5a3fa;hpb=9da16115b66545cd458729af23a690e907bd9094;p=src%2Fagl-compositor.git diff --git a/src/compositor.c b/src/compositor.c index 2c8c386..c38fb1c 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -199,7 +199,8 @@ handle_output_destroy(struct wl_listener *listener, void *data) 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; } @@ -539,7 +540,7 @@ try_attach_heads(struct ivi_output *output) { 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], @@ -550,6 +551,39 @@ try_attach_heads(struct ivi_output *output) 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. @@ -561,6 +595,8 @@ try_enable_output(struct ivi_output *output, size_t i) for (; i < output->add_len; ++i) { struct weston_head *head; + weston_output_lazy_align(output->output); + if (weston_output_enable(output->output) == 0) break;