[PATCH weston] shell: When rotating use the parent if available

Bryce Harrington bryce at osg.samsung.com
Thu Sep 3 13:26:50 PDT 2015


On Wed, Sep 02, 2015 at 11:32:05AM -0500, Derek Foreman wrote:
> This prevents the rotation mouse bind from rotating pop-up menus
> directly by using a shell surface's eldest parent instead.
> 
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> ---
>  desktop-shell/shell.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index 034d39b..b080339 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -4993,6 +4993,12 @@ surface_rotate(struct shell_surface *surface, struct weston_pointer *pointer)
>  	float dx, dy;
>  	float r;
>  
> +	/* We don't want to rotate pop-ups, so let's always start
> +	 * rotations with a parent surface.
> +	 */
> +	while (surface->parent)
> +		surface = get_shell_surface(surface->parent);
> +

get_shell_surface() can return NULL, so best check for that too.

I'm also curious if this is the right behavior, although I'll admit
fairly broad ignorance of shell.c internals.  But if the window is just
a popup, wouldn't we only need to operate on the immediate parent one
level up?  Also, couldn't there be surfaces that have parents that
aren't pop-ups?

Bryce

>  	rotate = malloc(sizeof *rotate);
>  	if (!rotate)
>  		return;
> -- 
> 2.5.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