libweston: Don't move outputs during enable

This is pretty counter-intuitive, and should probably happen outside of
the core in the front end while configuring the outputs.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
dev
Derek Foreman 2 years ago committed by Daniel Stone
parent 3b3fdc52c3
commit 8409b74ec2
  1. 36
      compositor/main.c
  2. 13
      libweston/compositor.c

@ -1707,6 +1707,38 @@ wet_head_tracker_create(struct wet_compositor *compositor,
weston_head_add_destroy_listener(head, &track->head_destroy_listener);
}
/* 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;
}
static void
simple_head_enable(struct wet_compositor *wet, struct weston_head *head)
{
@ -1723,6 +1755,8 @@ simple_head_enable(struct wet_compositor *wet, struct weston_head *head)
return;
}
weston_output_lazy_align(output);
if (wet->simple_output_configure)
ret = wet->simple_output_configure(output);
if (ret < 0) {
@ -2359,6 +2393,8 @@ drm_try_enable(struct weston_output *output,
{
/* Try to enable, and detach heads one by one until it succeeds. */
while (!output->enabled) {
weston_output_lazy_align(output);
if (weston_output_enable(output) == 0)
return 0;

@ -7268,11 +7268,8 @@ weston_output_create_heads_string(struct weston_output *output)
WL_EXPORT int
weston_output_enable(struct weston_output *output)
{
struct weston_compositor *c = output->compositor;
struct weston_output *iterator;
struct weston_head *head;
char *head_names;
int x = 0, y = 0;
if (output->enabled) {
weston_log("Error: attempt to enable an enabled output '%s'\n",
@ -7297,20 +7294,12 @@ weston_output_enable(struct weston_output *output)
assert(head->model);
}
iterator = container_of(c->output_list.prev,
struct weston_output, link);
if (!wl_list_empty(&c->output_list))
x = iterator->x + iterator->width;
/* Make sure the scale is set up */
assert(output->scale);
/* Make sure we have a transform set */
assert(output->transform != UINT32_MAX);
output->x = x;
output->y = y;
output->dirty = 1;
output->original_scale = output->scale;
@ -7319,7 +7308,7 @@ weston_output_enable(struct weston_output *output)
weston_output_transform_scale_init(output, output->transform, output->scale);
weston_output_init_geometry(output, x, y);
weston_output_init_geometry(output, output->x, output->y);
weston_output_damage(output);
wl_list_init(&output->animation_list);

Loading…
Cancel
Save