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

Pekka Paalanen ppaalanen at gmail.com
Thu Aug 21 03:25:24 PDT 2014


On Thu, 21 Aug 2014 11:42:03 +0800
Boyan Ding <stu_dby at 126.com> wrote:

> Hi,
> 
> On Wed, 2014-08-20 at 17:50 +0300, Pekka Paalanen wrote:
> > 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.)
> 
> After comparing mine and Jonny's patches the more carefully, I found the
> patches' idea are different. Jonny's patch puts a "hard requirement"
> that when expanding in height on the top edge, titlebar shouldn't go
> under top panel or the resizing won't take effect (quite tricky here).
> While mine will clamp the y-coordinate of cursor position if it's on the
> panel.
> 
> I admit that my approach is somewhat too conservative. But there are
> some tricky edge case under which Jonny's approach doesn't work very
> well. Rotate a window clockwise 60-75 degrees, move it up until it can't
> be moved further. You will find the top edge can't expand (actually
> expanding the top edge here does no harm I think). More seriously,
> You'll find that if you shrink the top edge a little, it can't resize
> back! This behavior, in my opinion, is unacceptable, since too much
> constraint is put on rotated windows.
> 
> Also, if you rotate a window 90 degrees and expand the edge that is now
> on the top. It will go under the panel. This behavior isn't change by
> Jonny's patch but will be changed by mine since I believe the cursor
> position in panel shouldn't be used in resizing, regardless of which
> edge we are resizing, at least a clamped coordinate should be used.
> 
> I think an ideal solution should surely ensure an unrotated window not
> to be expanded under panel, but don't place too much restriction on
> rotated windows.
> 
> What's your idea?

I think I would prefer the approach, where the pointer location used
for move or resize is constrained. We should guarantee, that whatever
point you grabbed, was it move or resize, will always stay accessible,
i.e. within the work area. We could even have a safety margin around
that point.

I believe that should be fairly straightforward to implement, and the
behaviour would also be obvious to a user.

You don't have to constrain the cursor, just constrain the move or
resize operation to keep the grab point accessible, if possible. That
should also work well together with xdg_shell, as I recall a client
must not make a surface bigger than asked for, but in some cases it
might be smaller (weston-terminal step-sized resizing).

I didn't much like the behaviour, where if you moved the cursor fast,
the resizing might stop farther away from the limit compared to if you
moved the cursor slowly.

With these thoughts, I will be waiting for new patches for this issue,
and hopefully also for the below. :-)


Thanks,
pq

> > 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.
> 
> Yeah, I also noticed that. Maybe we should change that, too.
> 
> Cheers,
> Boyan Ding


More information about the wayland-devel mailing list