[PATCH weston 3/3] shell: constrain resize grabs so titlebars don't go under the panel

Pekka Paalanen ppaalanen at gmail.com
Wed Aug 20 07:50:19 PDT 2014


On Wed, 20 Aug 2014 15:53:21 +0200
Jonny Lamb <jonny.lamb at collabora.co.uk> wrote:

> https://bugs.freedesktop.org/show_bug.cgi?id=80228
> ---
>  desktop-shell/shell.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index e3abaad..e3241fd 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -1758,6 +1758,30 @@ struct weston_resize_grab {
>  };
>  
>  static void
> +constrain_resize_grab(struct weston_pointer_grab *grab,
> +		      int32_t *width, int32_t *height)
> +{
> +	struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
> +	struct shell_surface *shsurf = resize->base.shsurf;
> +
> +	int32_t height_difference;
> +
> +	height_difference = *height - shsurf->geometry.height;
> +
> +	/* we're only trying to make sure titlebars don't go under the panel */
> +	if (shsurf->shell->panel_position == DESKTOP_SHELL_PANEL_POSITION_TOP &&
> +	    resize->edges & WL_SHELL_SURFACE_RESIZE_TOP &&
> +	    height_difference > 0) {
> +		int32_t top;
> +
> +		top = shsurf->view->geometry.y - height_difference;
> +
> +		if (top < 0)
> +			*height = shsurf->geometry.height;
> +	}
> +}
> +
> +static void
>  resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
>  		   wl_fixed_t x, wl_fixed_t y)
>  {
> @@ -1793,6 +1817,8 @@ resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
>  		height += wl_fixed_to_int(to_y - from_y);
>  	}
>  
> +	constrain_resize_grab(grab, &width, &height);
> +
>  	shsurf->client->send_configure(shsurf->surface, width, height);
>  }
>  

Hi,

on first glance, it looks like this completely ignores window rotation,
but when I briefly tested on a rotated window, it seemed work well
enough! :-o

I can't figure out why.

Now, Boyan's patch at least tries to take rotation into account:
http://lists.freedesktop.org/archives/wayland-devel/2014-June/015658.html
but will not work since I merged the two patches from Jonny, and needs
a rebase if we choose it.

Then there was the patch from Vivek:
http://lists.freedesktop.org/archives/wayland-devel/2014-June/015528.html
which I don't think handles rotated windows either? The same reason to
rebase as for Boyan's patch.

Were there others I missed?

Boyan, can you see if Jonny's patch is right, or did I just not poke
it the right way to make it break? Just merging that would be
the easiest. If you don't like it, could you two agree on who makes the
next one?

Or do we just not care enough about rotated windows? :-)
(I'd be fine with that, on resizing.)


Btw. it seems that rotated windows already have issues with move
constraints. Try to open a window fairly big, rotate it 180 degrees,
grab the window's bottom (which is now facing up), and resize the
window to very short. Then, try to move the window around the desktop.
I cannot move the window up past some arbitrary point in the middle of
the desktop, while there clearly is room to move.


Thanks,
pq


More information about the wayland-devel mailing list