compositor: only reflow the outputs if the shell did not move them

weston_compositor_reflow_outputs() assumes that all output are positioned from
left to right with no gaps in the same order in which they where created.

If the shell moves an output with weston_output_move() then this assumption is
no longer true. So stop reflowing the outputs in the case. The shell is now
responsible for positioning all outputs as needed.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
dev
Michael Olbrich 2 years ago committed by Derek Foreman
parent 59a72dcf63
commit 48e8c158ea
  1. 1
      include/libweston/libweston.h
  2. 22
      libweston/compositor.c

@ -1263,6 +1263,7 @@ struct weston_compositor {
struct wl_list plugin_api_list; /* struct weston_plugin_api::link */
uint32_t output_id_pool;
bool output_flow_dirty;
struct xkb_rule_names xkb_names;
struct xkb_context *xkb_context;

@ -6253,6 +6253,9 @@ weston_head_get_destroy_listener(struct weston_head *head,
return wl_signal_get(&head->destroy_signal, notify);
}
static void
weston_output_set_position(struct weston_output *output, int x, int y);
/* Move other outputs when one is resized so the space remains contiguous. */
static void
weston_compositor_reflow_outputs(struct weston_compositor *compositor,
@ -6261,6 +6264,9 @@ weston_compositor_reflow_outputs(struct weston_compositor *compositor,
struct weston_output *output;
bool start_resizing = false;
if (compositor->output_flow_dirty)
return;
if (!delta_width)
return;
@ -6271,7 +6277,7 @@ weston_compositor_reflow_outputs(struct weston_compositor *compositor,
}
if (start_resizing) {
weston_output_move(output, output->x + delta_width, output->y);
weston_output_set_position(output, output->x + delta_width, output->y);
output->dirty = 1;
}
}
@ -6377,8 +6383,8 @@ weston_output_init_geometry(struct weston_output *output, int x, int y)
/**
* \ingroup output
*/
WL_EXPORT void
weston_output_move(struct weston_output *output, int x, int y)
static void
weston_output_set_position(struct weston_output *output, int x, int y)
{
struct weston_head *head;
struct wl_resource *resource;
@ -6424,6 +6430,16 @@ weston_output_move(struct weston_output *output, int x, int y)
}
}
/**
* \ingroup output
*/
WL_EXPORT void
weston_output_move(struct weston_output *output, int x, int y)
{
output->compositor->output_flow_dirty = true;
weston_output_set_position(output, x, y);
}
/** Signal that a pending output is taken into use.
*
* Removes the output from the pending list and adds it to the compositor's

Loading…
Cancel
Save