[PATCH] shell: run surface bindings only when focus surface is not NULL

Bill Spitzak spitzak at gmail.com
Thu Jan 9 11:37:20 PST 2014


Rafal Mielniczuk wrote:
> This fixes the crash when move, rotate or resize binding is activated
> while exposay effect is active.

> +	if (seat->pointer->focus == NULL)
> +		return;
> +
> +	focus = seat->pointer->focus->surface;
> +
>  	surface = weston_surface_get_main_surface(focus);
>  	if (surface == NULL)
>  		return;

All these patches make it look a lot like the seat->pointer->focus 
object, rather than a surface, be used everywhere for "focus". IE the 
above code is replaced by something like this:

         struct weston_focus *focus = seat->pointer->focus;
         if (!focus) return;
         surface = weston_focus_get_main_surface(focus);
         if (!surface) return;

As another point I greatly prefer "!surface" over "surface == NULL". I'm 
not sure if it is me but I always misread "surface == NULL" as "surface 
!= NULL" because I think of not-null as "true". Not sure what the 
wayland code guidelines say.


More information about the wayland-devel mailing list