compositor: move output assignment to update_transform
authorPekka Paalanen <ppaalanen@gmail.com>
Fri, 10 Feb 2012 11:34:36 +0000 (13:34 +0200)
committerPekka Paalanen <ppaalanen@gmail.com>
Fri, 10 Feb 2012 13:50:27 +0000 (15:50 +0200)
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 <ppaalanen@gmail.com>
src/compositor.c
src/shell.c
src/tablet-shell.c

index 3375558..507fcda 100644 (file)
@@ -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;
index fbb1203..38a2600 100644 (file)
@@ -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;
index bcaba16..5e8d5f1 100644 (file)
@@ -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