[PATCH weston 2/2] compositor: Always assign an output when updating a surface transform

Kristian Høgsberg hoegsberg at gmail.com
Fri Sep 14 10:44:33 PDT 2012


On Fri, Sep 14, 2012 at 04:12:04PM +0300, Ander Conselvan de Oliveira wrote:
> From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
> 
> 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.

That looks good, thanks.

Kristian

> ---
>  src/compositor.c   |    9 ++++-----
>  src/shell.c        |   12 ++++++------
>  src/tablet-shell.c |    2 +-
>  tests/event-test.c |    2 +-
>  tests/text-test.c  |    2 +-
>  5 files changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/src/compositor.c b/src/compositor.c
> index bda1381..8c8dff0 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -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);
>  }
>  
> diff --git a/src/shell.c b/src/shell.c
> index dba54f7..4967248 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -866,6 +866,7 @@ move_surface_to_workspace(struct desktop_shell *shell,
>  			wl_keyboard_set_focus(&seat->keyboard, NULL);
>  
>  	weston_surface_damage_below(surface);
> +
>  }
>  
>  static void
> @@ -2190,7 +2191,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 +2764,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 +2919,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 +2992,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 +3130,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 +3469,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
> diff --git a/src/tablet-shell.c b/src/tablet-shell.c
> index af5e66f..3623736 100644
> --- a/src/tablet-shell.c
> +++ b/src/tablet-shell.c
> @@ -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
> diff --git a/tests/event-test.c b/tests/event-test.c
> index e137213..2cbfc2d 100644
> --- a/tests/event-test.c
> +++ b/tests/event-test.c
> @@ -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);
> diff --git a/tests/text-test.c b/tests/text-test.c
> index 9b0f88c..942cb3b 100644
> --- a/tests/text-test.c
> +++ b/tests/text-test.c
> @@ -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);
> -- 
> 1.7.9.5
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list