compositor: Move the logic of moving outputs into the core
Instead of having the backends move the remaining outputs when one is destroyed, let the core compositor deal with that. Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
This commit is contained in:
parent
f749fc3782
commit
a4b54c0b79
@ -2222,7 +2222,6 @@ update_outputs(struct drm_compositor *ec, struct udev_device *drm_device)
|
||||
drmModeRes *resources;
|
||||
struct drm_output *output, *next;
|
||||
int x = 0, y = 0;
|
||||
int x_offset = 0, y_offset = 0;
|
||||
uint32_t connected = 0, disconnects = 0;
|
||||
int i;
|
||||
|
||||
@ -2272,17 +2271,10 @@ update_outputs(struct drm_compositor *ec, struct udev_device *drm_device)
|
||||
if (disconnects) {
|
||||
wl_list_for_each_safe(output, next, &ec->base.output_list,
|
||||
base.link) {
|
||||
if (x_offset != 0 || y_offset != 0) {
|
||||
weston_output_move(&output->base,
|
||||
output->base.x - x_offset,
|
||||
output->base.y - y_offset);
|
||||
}
|
||||
|
||||
if (disconnects & (1 << output->connector_id)) {
|
||||
disconnects &= ~(1 << output->connector_id);
|
||||
weston_log("connector %d disconnected\n",
|
||||
output->connector_id);
|
||||
x_offset += output->base.width;
|
||||
drm_output_destroy(&output->base);
|
||||
}
|
||||
}
|
||||
|
@ -918,24 +918,10 @@ x11_compositor_find_output(struct x11_compositor *c, xcb_window_t window)
|
||||
static void
|
||||
x11_compositor_delete_window(struct x11_compositor *c, xcb_window_t window)
|
||||
{
|
||||
struct x11_output *deleted_output, *output, *next;
|
||||
int x_offset = 0;
|
||||
struct x11_output *output;
|
||||
|
||||
deleted_output = x11_compositor_find_output(c, window);
|
||||
|
||||
wl_list_for_each_safe(output, next, &c->base.output_list, base.link) {
|
||||
if (x_offset != 0) {
|
||||
weston_output_move(&output->base,
|
||||
output->base.x - x_offset,
|
||||
output->base.y);
|
||||
weston_output_damage(&output->base);
|
||||
}
|
||||
|
||||
if (output == deleted_output) {
|
||||
x_offset += output->base.width;
|
||||
x11_output_destroy(&output->base);
|
||||
}
|
||||
}
|
||||
output = x11_compositor_find_output(c, window);
|
||||
x11_output_destroy(&output->base);
|
||||
|
||||
xcb_flush(c->conn);
|
||||
|
||||
|
@ -2993,9 +2993,32 @@ bind_output(struct wl_client *client,
|
||||
wl_output_send_done(resource);
|
||||
}
|
||||
|
||||
/* Move other outputs when one is removed so the space remains contiguos. */
|
||||
static void
|
||||
weston_compositor_remove_output(struct weston_compositor *compositor,
|
||||
struct weston_output *remove_output)
|
||||
{
|
||||
struct weston_output *output;
|
||||
int offset = 0;
|
||||
|
||||
wl_list_for_each(output, &compositor->output_list, link) {
|
||||
if (output == remove_output) {
|
||||
offset = output->width;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (offset > 0) {
|
||||
weston_output_move(output,
|
||||
output->x - offset, output->y);
|
||||
output->dirty = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
weston_output_destroy(struct weston_output *output)
|
||||
{
|
||||
weston_compositor_remove_output(output->compositor, output);
|
||||
wl_list_remove(&output->link);
|
||||
|
||||
wl_signal_emit(&output->destroy_signal, output);
|
||||
|
Loading…
Reference in New Issue
Block a user