[PATCH weston] window: Disregard motion events outside our current surface dimensions

Kristian Høgsberg hoegsberg at gmail.com
Fri Jul 12 21:01:29 PDT 2013


On Thu, Jul 11, 2013 at 07:41:27PM +0100, Rob Bradford wrote:
> From: Rob Bradford <rob at linux.intel.com>
> 
> It is possible to receive a motion event that was generated by the
> compositor based on a pick of a surface of old dimensions. This was
> triggerable on toytoolkit clients when minimising. The new window
> dimensions were propagated through the widget hierarchy before the event
> was dispatched.
> 
> This issue was triggering a segfault due to the focussed widget being
> lost as the client code tried to identify which widget should have the
> focus using co-ordinates outside the dimensions of the surface.

Yup, I saw that too, thanks for tracking that down.  Patch applied.

Kristian

> https://bugs.freedesktop.org/show_bug.cgi?id=66795
> ---
>  clients/window.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/clients/window.c b/clients/window.c
> index 93a0a2c..1ca13ed 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -2795,6 +2795,14 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
>  	float sx = wl_fixed_to_double(sx_w);
>  	float sy = wl_fixed_to_double(sy_w);
>  
> +	/* when making the window smaller - e.g. after a unmaximise we might
> +	 * still have a pending motion event that the compositor has picked
> +	 * based on the old surface dimensions
> +	 */
> +	if (sx > window->main_surface->allocation.width ||
> +	    sy > window->main_surface->allocation.height)
> +		return;
> +
>  	input->sx = sx;
>  	input->sy = sy;
>  
> -- 
> 1.8.3.1
> 
> _______________________________________________
> 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