[PATCH wayland-protocols 00/11] Declaring xdg-shell stable

Jonas Ã…dahl jadahl at gmail.com
Fri Jun 23 04:03:24 UTC 2017


On Thu, Jun 22, 2017 at 06:38:00PM +0100, David Edmundson wrote:
> >
> > For flipping, it's a bit more non straight forward, as
> > flipping and the offset are not very useful in combination,
> >
> 
> Yes, I think it's only when flipped where we need some additional
> clarification.
> 
> 
> > How about we add the following paragraph to the flip_x/y descriptions:
> >
> >           The adjusted position is calculated given the original anchor
> >           rectangle and offset, but with the new flipped anchor and gravity
> >           values.
> >
> 
> 
> I'm not sure that's what we want. In the case of a combobox where we want
> the dropdown to appear beneath the main UI controls with a gap, if we don't
> flip the offset we'll end up now overlapping the controls.
> 
> To hopefully explain what I mean:
> http://static.davidedmundson.co.uk/not_flipped.png   - some popup anchored
> to the text box (anchor bottom, gravity bottom) some +y offset.
> 
> Now for some reason that's constrained and it has flipY.
> http://static.davidedmundson.co.uk/flipped.png   - now flipped (anchor top,
> gravity top) but because we have a positive offset, we end up overlapping
> the control we're anchored round.

I see. You use the offset to add "padding" to the anchor rect? If I
understand things correctly, you could achieve the same thing with
including the padding on the anchor rect here.

> 
> I don't fully grasp what the anchor offset is for. A toolkit can acheive
> the same functionality by simply making the anchor rect bigger and that
> implicitly also gives the client the flexibility on how an offset when
> flipped should be handled.

The offset is mostly a convenience method for placing a combo box on top
of a anchor rectangle, without having to move around the anchor
rectangle in ways that would require us to allow the anchor rect to be
outside of the window region.

For example, shown with ASCII art:

                               +----+  - - - -
                               |    |        ^
  +-------------+       +------|    |-+      |  -y-offset
  |       ____  |       |      |____| |_ _ _ v
  |      |____| |       |      |____| |
  |             |       |      |    | |
  +-------------+       +------|    |-+
                               +----+


This tries to illustrate where we have a button that when clicked opens
a combo box with the already selected entry placed on top of the button
that opened it. The issue here being that the popup might extend outside
of the parent window, meaning we can't place it "against" any anchor
rectangle within the window. This is what the offset was added for.

With that said, I have yet to think of a use case where an offset is
useful together with flipping, at least not when there is an offset on
the same axis that is flipped.


Jonas


More information about the wayland-devel mailing list