From f07cb5d5f088e92e6f8021e82a0d6620f5d6e811 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 10 Feb 2012 13:34:36 +0200 Subject: [PATCH] compositor: move output assignment to update_transform Move the call to assign an output from weston_surface_configure() to weston_surface_update_transform(). As update_transform takes new geometry into use, it should also reassign the output for the surface, but only if an output was already assigned. Add explicit assing output calls to where we relied on weston_surface_configure() unconditionally assigning the output. Signed-off-by: Pekka Paalanen --- src/compositor.c | 14 ++++++++------ src/shell.c | 13 ++++++------- src/tablet-shell.c | 1 + 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 3375558b..507fcdab 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -387,6 +387,10 @@ weston_surface_update_transform(struct weston_surface *surface) else pixman_region32_init(&surface->transform.opaque); + + if (surface->output) + weston_surface_assign_output(surface); + weston_compositor_schedule_repaint(surface->compositor); } @@ -503,16 +507,11 @@ WL_EXPORT void weston_surface_configure(struct weston_surface *surface, GLfloat x, GLfloat y, int width, int height) { - weston_surface_damage_below(surface); - surface->geometry.x = x; surface->geometry.y = y; surface->geometry.width = width; surface->geometry.height = height; surface->geometry.dirty = 1; - - weston_surface_assign_output(surface); - weston_surface_damage(surface); } WL_EXPORT uint32_t @@ -1060,6 +1059,7 @@ weston_compositor_fade(struct weston_compositor *compositor, float tint) weston_surface_configure(surface, 0, 0, 8192, 8192); weston_surface_set_color(surface, 0.0, 0.0, 0.0, 0.0); wl_list_insert(&compositor->surface_list, &surface->link); + weston_surface_assign_output(surface); compositor->fade.surface = surface; } @@ -1700,9 +1700,11 @@ input_device_attach(struct wl_client *client, return; } - if (!device->sprite->output) + if (!device->sprite->output) { wl_list_insert(&compositor->surface_list, &device->sprite->link); + weston_surface_assign_output(device->sprite); + } buffer = buffer_resource->data; device->hotspot_x = x; diff --git a/src/shell.c b/src/shell.c index fbb12033..38a2600f 100644 --- a/src/shell.c +++ b/src/shell.c @@ -854,11 +854,13 @@ resume_desktop(struct wl_shell *shell) terminate_screensaver(shell); - wl_list_for_each(surface, &shell->hidden_surface_list, link) + wl_list_for_each(surface, &shell->hidden_surface_list, link) { weston_surface_configure(surface, surface->geometry.x, surface->geometry.y, surface->geometry.width, surface->geometry.height); + weston_surface_assign_output(surface); + } if (wl_list_empty(&shell->backgrounds)) { list = &shell->compositor->surface_list; @@ -1392,6 +1394,7 @@ map(struct weston_shell *base, weston_surface_configure(surface, surface->geometry.x, surface->geometry.y, width, height); + weston_surface_assign_output(surface); weston_compositor_repick(compositor); } @@ -1441,14 +1444,10 @@ configure(struct weston_shell *base, struct weston_surface *surface, break; } - /* - * weston_surface_configure() will assign an output, which means - * the surface is supposed to be in compositor->surface_list. - * Be careful with that, and make sure we stay on the right output. - * XXX: would a fullscreen surface need the same handling? - */ + /* XXX: would a fullscreen surface need the same handling? */ if (do_configure) { weston_surface_configure(surface, x, y, width, height); + weston_surface_assign_output(surface); if (surface_type == SHELL_SURFACE_SCREENSAVER) surface->output = shsurf->output; diff --git a/src/tablet-shell.c b/src/tablet-shell.c index bcaba161..5e8d5f12 100644 --- a/src/tablet-shell.c +++ b/src/tablet-shell.c @@ -136,6 +136,7 @@ tablet_shell_map(struct weston_shell *base, struct weston_surface *surface, wl_list_insert(&shell->compositor->surface_list, &surface->link); weston_surface_configure(surface, surface->geometry.x, surface->geometry.y, width, height); + weston_surface_assign_output(surface); } static void