compositor: Always assign an output when updating a surface transform

Also make all the callers of weston_surface_assign_output() update the
transform instead. This makes sure that when the surface is assigned an
output its bouding box is valid.

This fixes a bug where a newly created surface would have a NULL output
assigned. This would cause weston_surface_schedule_repaint() to not
schedule a repaint, preventing the surface to be shown until something
else caused a repaint.
This commit is contained in:
Ander Conselvan de Oliveira 2012-09-14 16:12:04 +03:00 committed by Kristian Høgsberg
parent 8ea818fb00
commit 231ba171c6
5 changed files with 12 additions and 14 deletions

View file

@ -456,8 +456,7 @@ weston_surface_update_transform(struct weston_surface *surface)
weston_surface_damage_below(surface);
if (weston_surface_is_mapped(surface))
weston_surface_assign_output(surface);
weston_surface_assign_output(surface);
}
WL_EXPORT void
@ -1026,7 +1025,7 @@ weston_compositor_fade(struct weston_compositor *compositor, float tint)
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 0.0);
wl_list_insert(&compositor->fade_layer.surface_list,
&surface->layer_link);
weston_surface_assign_output(surface);
weston_surface_update_transform(surface);
compositor->fade.surface = surface;
pixman_region32_init(&surface->input);
}
@ -1929,7 +1928,7 @@ pointer_cursor_surface_configure(struct weston_surface *es,
if (!weston_surface_is_mapped(es)) {
wl_list_insert(&es->compositor->cursor_layer.surface_list,
&es->layer_link);
weston_surface_assign_output(es);
weston_surface_update_transform(es);
}
}
@ -2416,7 +2415,7 @@ device_map_drag_surface(struct weston_seat *seat)
list = &seat->compositor->cursor_layer.surface_list;
wl_list_insert(list, &seat->drag_surface->layer_link);
weston_surface_assign_output(seat->drag_surface);
weston_surface_update_transform(seat->drag_surface);
empty_region(&seat->drag_surface->input);
}

View file

@ -2190,7 +2190,7 @@ lock_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
if (!weston_surface_is_mapped(surface)) {
wl_list_insert(&shell->lock_layer.surface_list,
&surface->layer_link);
weston_surface_assign_output(surface);
weston_surface_update_transform(surface);
weston_compositor_wake(shell->compositor);
}
}
@ -2763,7 +2763,7 @@ show_input_panels(struct wl_listener *listener, void *data)
ws = surface->surface;
wl_list_insert(&shell->input_panel_layer.surface_list,
&ws->layer_link);
weston_surface_assign_output(ws);
weston_surface_update_transform(ws);
weston_surface_damage(ws);
weston_slide_run(ws, ws->geometry.height, 0, NULL, NULL);
}
@ -2918,7 +2918,7 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
}
if (surface_type != SHELL_SURFACE_NONE) {
weston_surface_assign_output(surface);
weston_surface_update_transform(surface);
if (surface_type == SHELL_SURFACE_MAXIMIZED)
surface->output = shsurf->output;
}
@ -2991,7 +2991,7 @@ configure(struct desktop_shell *shell, struct weston_surface *surface,
/* XXX: would a fullscreen surface need the same handling? */
if (surface->output) {
weston_surface_assign_output(surface);
weston_surface_update_transform(surface);
if (surface_type == SHELL_SURFACE_MAXIMIZED)
surface->output = shsurf->output;
@ -3129,7 +3129,7 @@ screensaver_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
if (wl_list_empty(&surface->layer_link)) {
wl_list_insert(shell->lock_layer.surface_list.prev,
&surface->layer_link);
weston_surface_assign_output(surface);
weston_surface_update_transform(surface);
shell->compositor->idle_time = shell->screensaver.duration;
weston_compositor_wake(shell->compositor);
shell->compositor->state = WESTON_COMPOSITOR_IDLE;
@ -3468,7 +3468,6 @@ debug_repaint_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
weston_surface_configure(surface, 0, 0, 8192, 8192);
wl_list_insert(&compositor->fade_layer.surface_list,
&surface->layer_link);
weston_surface_assign_output(surface);
pixman_region32_init(&surface->input);
/* Here's the dirty little trick that makes the

View file

@ -162,7 +162,7 @@ tablet_shell_surface_configure(struct weston_surface *surface,
&surface->layer_link);
}
weston_surface_assign_output(surface);
weston_surface_update_transform(surface);
}
static void

View file

@ -49,7 +49,7 @@ handle_surface(struct test_client *client)
surface = (struct weston_surface *) resource;
weston_surface_configure(surface, 100, 100, 200, 200);
weston_surface_assign_output(surface);
weston_surface_update_transform(surface);
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
wl_list_insert(&layer->surface_list, &surface->layer_link);
weston_surface_damage(surface);

View file

@ -178,7 +178,7 @@ handle_surface(struct test_client *client)
surface = (struct weston_surface *) resource;
weston_surface_configure(surface, 100, 100, 200, 200);
weston_surface_assign_output(surface);
weston_surface_update_transform(surface);
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
data->layer = malloc(sizeof *data->layer);