xdg-shell: clarify popup constrain's slide mechanism

Submitted by Mike Blumenkrantz on Nov. 16, 2016, 3:23 p.m.

Details

Message ID 1479309839-9232-1-git-send-email-zmike@osg.samsung.com
State New
Headers show
Series "xdg-shell: clarify popup constrain's slide mechanism" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Mike Blumenkrantz Nov. 16, 2016, 3:23 p.m.
some restrictions must be placed on this or else it becomes legal for
the compositor to place popups in unexpected locations when sliding
is allowed

Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
---
 unstable/xdg-shell/xdg-shell-unstable-v6.xml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
index 6053e3c..30cdaeb 100644
--- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
+++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
@@ -256,7 +256,8 @@ 
       </entry>
       <entry name="slide_x" value="1">
 	<description summary="move along the x axis until unconstrained">
-	  Slide the surface along the x axis until it is no longer constrained.
+	  Slide the surface along the x axis within the toplevel surface until it
+	  is no longer constrained.
 
 	  First try to slide towards the direction of the gravity on the x axis
 	  until either the edge in the opposite direction of the gravity is
@@ -271,7 +272,8 @@ 
       </entry>
       <entry name="slide_y" value="2">
 	<description summary="move along the y axis until unconstrained">
-	  Slide the surface along the y axis until it is no longer constrained.
+	  Slide the surface along the y axis within the toplevel surface until it
+	  is no longer constrained.
 
 	  First try to slide towards the direction of the gravity on the y axis
 	  until either the edge in the opposite direction of the gravity is

Comments

Some background:

I was implementing v6 over the past few days and noticed, while handling
constraints, that this was a hugely problematic scenario. If a popup was
constrained in a particular way, the compositor could conceivably place it
on the opposite side of the screen over unrelated windows--certainly not
good behavior.

Clamping to the overall toplevel in some way seems pretty sane; popups must
originate from the toplevel (even nested popups), so forcing them to in
some way remain within the toplevel, even if it's only touching the
toplevel by a 1x1 rect, will preserve that relationship.

On Wed, Nov 16, 2016 at 10:24 AM Mike Blumenkrantz <zmike@osg.samsung.com>
wrote:

> some restrictions must be placed on this or else it becomes legal for
> the compositor to place popups in unexpected locations when sliding
> is allowed
>
> Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
> ---
>  unstable/xdg-shell/xdg-shell-unstable-v6.xml | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> index 6053e3c..30cdaeb 100644
> --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> @@ -256,7 +256,8 @@
>        </entry>
>        <entry name="slide_x" value="1">
>         <description summary="move along the x axis until unconstrained">
> -         Slide the surface along the x axis until it is no longer
> constrained.
> +         Slide the surface along the x axis within the toplevel surface
> until it
> +         is no longer constrained.
>
>           First try to slide towards the direction of the gravity on the x
> axis
>           until either the edge in the opposite direction of the gravity is
> @@ -271,7 +272,8 @@
>        </entry>
>        <entry name="slide_y" value="2">
>         <description summary="move along the y axis until unconstrained">
> -         Slide the surface along the y axis until it is no longer
> constrained.
> +         Slide the surface along the y axis within the toplevel surface
> until it
> +         is no longer constrained.
>
>           First try to slide towards the direction of the gravity on the y
> axis
>           until either the edge in the opposite direction of the gravity is
> --
> 2.5.5
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
Hi Mike,

> On Nov 16, 2016, at 7:23 AM, Mike Blumenkrantz <zmike@osg.samsung.com> wrote:
> 
> some restrictions must be placed on this or else it becomes legal for
> the compositor to place popups in unexpected locations when sliding
> is allowed
> 
> Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>

Per your description of the problem, this protocol change seems to make
sense, and adds specificity to the constraining behavior. I can't think
of any drawbacks to adding this.

Reviewed-by: Yong Bakos <ybakos@humanoriented.com>

yong



> ---
> unstable/xdg-shell/xdg-shell-unstable-v6.xml | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> index 6053e3c..30cdaeb 100644
> --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> @@ -256,7 +256,8 @@
>       </entry>
>       <entry name="slide_x" value="1">
> 	<description summary="move along the x axis until unconstrained">
> -	  Slide the surface along the x axis until it is no longer constrained.
> +	  Slide the surface along the x axis within the toplevel surface until it
> +	  is no longer constrained.
> 
> 	  First try to slide towards the direction of the gravity on the x axis
> 	  until either the edge in the opposite direction of the gravity is
> @@ -271,7 +272,8 @@
>       </entry>
>       <entry name="slide_y" value="2">
> 	<description summary="move along the y axis until unconstrained">
> -	  Slide the surface along the y axis until it is no longer constrained.
> +	  Slide the surface along the y axis within the toplevel surface until it
> +	  is no longer constrained.
> 
> 	  First try to slide towards the direction of the gravity on the y axis
> 	  until either the edge in the opposite direction of the gravity is
> -- 
> 2.5.5
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
On Thu, Nov 17, 2016 at 07:32:02AM -0800, Yong Bakos wrote:
> Hi Mike,
> 
> > On Nov 16, 2016, at 7:23 AM, Mike Blumenkrantz <zmike@osg.samsung.com> wrote:
> > 
> > some restrictions must be placed on this or else it becomes legal for
> > the compositor to place popups in unexpected locations when sliding
> > is allowed
> > 
> > Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
> 
> Per your description of the problem, this protocol change seems to make
> sense, and adds specificity to the constraining behavior. I can't think
> of any drawbacks to adding this.
> 
> Reviewed-by: Yong Bakos <ybakos@humanoriented.com>

I agree, it specifies what seems to be an established assumption.  I
can't think of any sane reason for having popups appear dissociated with
the toplevel if sliding behavior is the layout intent.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>

> > ---
> > unstable/xdg-shell/xdg-shell-unstable-v6.xml | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> > index 6053e3c..30cdaeb 100644
> > --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> > +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> > @@ -256,7 +256,8 @@
> >       </entry>
> >       <entry name="slide_x" value="1">
> > 	<description summary="move along the x axis until unconstrained">
> > -	  Slide the surface along the x axis until it is no longer constrained.
> > +	  Slide the surface along the x axis within the toplevel surface until it
> > +	  is no longer constrained.
> > 
> > 	  First try to slide towards the direction of the gravity on the x axis
> > 	  until either the edge in the opposite direction of the gravity is
> > @@ -271,7 +272,8 @@
> >       </entry>
> >       <entry name="slide_y" value="2">
> > 	<description summary="move along the y axis until unconstrained">
> > -	  Slide the surface along the y axis until it is no longer constrained.
> > +	  Slide the surface along the y axis within the toplevel surface until it
> > +	  is no longer constrained.
> > 
> > 	  First try to slide towards the direction of the gravity on the y axis
> > 	  until either the edge in the opposite direction of the gravity is
> > -- 
> > 2.5.5
> > 
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
On Wed, Nov 16, 2016 at 10:23:59AM -0500, Mike Blumenkrantz wrote:
> some restrictions must be placed on this or else it becomes legal for
> the compositor to place popups in unexpected locations when sliding
> is allowed
> 
> Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
> ---
>  unstable/xdg-shell/xdg-shell-unstable-v6.xml | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> index 6053e3c..30cdaeb 100644
> --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> @@ -256,7 +256,8 @@
>        </entry>
>        <entry name="slide_x" value="1">
>  	<description summary="move along the x axis until unconstrained">
> -	  Slide the surface along the x axis until it is no longer constrained.
> +	  Slide the surface along the x axis within the toplevel surface until it
> +	  is no longer constrained.

This would break chained popup menus in GTK+. For example a menu chain
where eventually a menu now completely outside of the toplevel window
region hits the edge of monitor, and is supposed to slide (see
screenshot [0]).

So I think we should just limit the way we can slide in relation to the
parent. Maybe we should rather put the limitations somewhere more
generic? I.e. a popup can only ever be positioned so that its window
geometry "touches" (where touches means that there will be no space in
between) its parent window geometry, or something like that?


Jonas


[0] https://people.freedesktop.org/~jadahl/menu-slide-outside-of-toplevel.png

>  
>  	  First try to slide towards the direction of the gravity on the x axis
>  	  until either the edge in the opposite direction of the gravity is
> @@ -271,7 +272,8 @@
>        </entry>
>        <entry name="slide_y" value="2">
>  	<description summary="move along the y axis until unconstrained">
> -	  Slide the surface along the y axis until it is no longer constrained.
> +	  Slide the surface along the y axis within the toplevel surface until it
> +	  is no longer constrained.
>  
>  	  First try to slide towards the direction of the gravity on the y axis
>  	  until either the edge in the opposite direction of the gravity is
> -- 
> 2.5.5
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
On Fri, 18 Nov 2016 09:28:56 +0800
Jonas Ådahl <jadahl@gmail.com> wrote:

> On Wed, Nov 16, 2016 at 10:23:59AM -0500, Mike Blumenkrantz wrote:
> > some restrictions must be placed on this or else it becomes legal for
> > the compositor to place popups in unexpected locations when sliding
> > is allowed
> > 
> > Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
> > ---
> >  unstable/xdg-shell/xdg-shell-unstable-v6.xml | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> > index 6053e3c..30cdaeb 100644
> > --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> > +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> > @@ -256,7 +256,8 @@
> >        </entry>
> >        <entry name="slide_x" value="1">
> >  	<description summary="move along the x axis until unconstrained">
> > -	  Slide the surface along the x axis until it is no longer constrained.
> > +	  Slide the surface along the x axis within the toplevel surface until it
> > +	  is no longer constrained.  
> 
> This would break chained popup menus in GTK+. For example a menu chain
> where eventually a menu now completely outside of the toplevel window
> region hits the edge of monitor, and is supposed to slide (see
> screenshot [0]).
> 
> So I think we should just limit the way we can slide in relation to the
> parent. Maybe we should rather put the limitations somewhere more
> generic? I.e. a popup can only ever be positioned so that its window
> geometry "touches" (where touches means that there will be no space in
> between) its parent window geometry, or something like that?
> 
> 
> Jonas
> 
> 
> [0] https://people.freedesktop.org/~jadahl/menu-slide-outside-of-toplevel.png
> 

Hm, while I strongly disagree with any application design that requires this level of submenu chaining, I can see why we might need to support at least basic submenu positioning outside the toplevel. I think changing "toplevel" to "parent" in my patch would address that sufficiently?

> >  
> >  	  First try to slide towards the direction of the gravity on the x axis
> >  	  until either the edge in the opposite direction of the gravity is
> > @@ -271,7 +272,8 @@
> >        </entry>
> >        <entry name="slide_y" value="2">
> >  	<description summary="move along the y axis until unconstrained">
> > -	  Slide the surface along the y axis until it is no longer constrained.
> > +	  Slide the surface along the y axis within the toplevel surface until it
> > +	  is no longer constrained.
> >  
> >  	  First try to slide towards the direction of the gravity on the y axis
> >  	  until either the edge in the opposite direction of the gravity is
> > -- 
> > 2.5.5
> > 
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/wayland-devel
On Mon, Nov 21, 2016 at 06:36:49AM -0500, Mike Blumenkrantz wrote:
> On Fri, 18 Nov 2016 09:28:56 +0800
> Jonas Ådahl <jadahl@gmail.com> wrote:
> 
> > On Wed, Nov 16, 2016 at 10:23:59AM -0500, Mike Blumenkrantz wrote:
> > > some restrictions must be placed on this or else it becomes legal for
> > > the compositor to place popups in unexpected locations when sliding
> > > is allowed
> > > 
> > > Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
> > > ---
> > >  unstable/xdg-shell/xdg-shell-unstable-v6.xml | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> > > index 6053e3c..30cdaeb 100644
> > > --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> > > +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> > > @@ -256,7 +256,8 @@
> > >        </entry>
> > >        <entry name="slide_x" value="1">
> > >  	<description summary="move along the x axis until unconstrained">
> > > -	  Slide the surface along the x axis until it is no longer constrained.
> > > +	  Slide the surface along the x axis within the toplevel surface until it
> > > +	  is no longer constrained.  
> > 
> > This would break chained popup menus in GTK+. For example a menu chain
> > where eventually a menu now completely outside of the toplevel window
> > region hits the edge of monitor, and is supposed to slide (see
> > screenshot [0]).
> > 
> > So I think we should just limit the way we can slide in relation to the
> > parent. Maybe we should rather put the limitations somewhere more
> > generic? I.e. a popup can only ever be positioned so that its window
> > geometry "touches" (where touches means that there will be no space in
> > between) its parent window geometry, or something like that?
> > 
> > 
> > Jonas
> > 
> > 
> > [0] https://people.freedesktop.org/~jadahl/menu-slide-outside-of-toplevel.png
> > 
> 
> Hm, while I strongly disagree with any application design that requires this level of submenu chaining, I can see why we might need to support at least basic submenu positioning outside the toplevel. I think changing "toplevel" to "parent" in my patch would address that sufficiently?

It sounds like the "sliding within the parent" means the whole child
surface must be within the parent, which is not the case. Maybe better
with "Slide the surface along the x/y axis until it is no longer
constrained or doesn't touch the parent surface anymore." or something.


Jonas

> 
> > >  
> > >  	  First try to slide towards the direction of the gravity on the x axis
> > >  	  until either the edge in the opposite direction of the gravity is
> > > @@ -271,7 +272,8 @@
> > >        </entry>
> > >        <entry name="slide_y" value="2">
> > >  	<description summary="move along the y axis until unconstrained">
> > > -	  Slide the surface along the y axis until it is no longer constrained.
> > > +	  Slide the surface along the y axis within the toplevel surface until it
> > > +	  is no longer constrained.
> > >  
> > >  	  First try to slide towards the direction of the gravity on the y axis
> > >  	  until either the edge in the opposite direction of the gravity is
> > > -- 
> > > 2.5.5
> > > 
> > > _______________________________________________
> > > wayland-devel mailing list
> > > wayland-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/wayland-devel  
>
On Wed, 23 Nov 2016 12:05:12 -0800
Bill Spitzak <spitzak@gmail.com> wrote:

> Much better to just say one of the "constraints" is that the child
> must touch the parent.
> 
> The specified api, despite attempts to prevent it, still allows
> starting positions that don't touch the parent (this can be achieved
> by using the offset, the restriction that the anchor rectangle be
> inside the parent does not help). So changing the definition of
> "constraints" to this would allow a position to fail if it does not
> touch, even before "sliding".
> 
> 
> On Mon, Nov 21, 2016 at 3:52 AM, Jonas Ådahl <jadahl@gmail.com> wrote:
> > On Mon, Nov 21, 2016 at 06:36:49AM -0500, Mike Blumenkrantz wrote:  
> >> On Fri, 18 Nov 2016 09:28:56 +0800
> >> Jonas Ådahl <jadahl@gmail.com> wrote:
> >>  
> >> > On Wed, Nov 16, 2016 at 10:23:59AM -0500, Mike Blumenkrantz wrote:  
> >> > > some restrictions must be placed on this or else it becomes legal for
> >> > > the compositor to place popups in unexpected locations when sliding
> >> > > is allowed
> >> > >
> >> > > Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
> >> > > ---
> >> > >  unstable/xdg-shell/xdg-shell-unstable-v6.xml | 6 ++++--
> >> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> >> > >
> >> > > diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> >> > > index 6053e3c..30cdaeb 100644
> >> > > --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> >> > > +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> >> > > @@ -256,7 +256,8 @@
> >> > >        </entry>
> >> > >        <entry name="slide_x" value="1">
> >> > >   <description summary="move along the x axis until unconstrained">
> >> > > -   Slide the surface along the x axis until it is no longer constrained.
> >> > > +   Slide the surface along the x axis within the toplevel surface until it
> >> > > +   is no longer constrained.  
> >> >
> >> > This would break chained popup menus in GTK+. For example a menu chain
> >> > where eventually a menu now completely outside of the toplevel window
> >> > region hits the edge of monitor, and is supposed to slide (see
> >> > screenshot [0]).
> >> >
> >> > So I think we should just limit the way we can slide in relation to the
> >> > parent. Maybe we should rather put the limitations somewhere more
> >> > generic? I.e. a popup can only ever be positioned so that its window
> >> > geometry "touches" (where touches means that there will be no space in
> >> > between) its parent window geometry, or something like that?
> >> >
> >> >
> >> > Jonas
> >> >
> >> >
> >> > [0] https://people.freedesktop.org/~jadahl/menu-slide-outside-of-toplevel.png
> >> >  
> >>
> >> Hm, while I strongly disagree with any application design that requires this level of submenu chaining, I can see why we might need to support at least basic submenu positioning outside the toplevel. I think changing "toplevel" to "parent" in my patch would address that sufficiently?  
> >
> > It sounds like the "sliding within the parent" means the whole child
> > surface must be within the parent, which is not the case. Maybe better
> > with "Slide the surface along the x/y axis until it is no longer
> > constrained or doesn't touch the parent surface anymore." or something.
> >
> >
> > Jonas
> >  
> >>  
> >> > >
> >> > >     First try to slide towards the direction of the gravity on the x axis
> >> > >     until either the edge in the opposite direction of the gravity is
> >> > > @@ -271,7 +272,8 @@
> >> > >        </entry>
> >> > >        <entry name="slide_y" value="2">
> >> > >   <description summary="move along the y axis until unconstrained">
> >> > > -   Slide the surface along the y axis until it is no longer constrained.
> >> > > +   Slide the surface along the y axis within the toplevel surface until it
> >> > > +   is no longer constrained.
> >> > >
> >> > >     First try to slide towards the direction of the gravity on the y axis
> >> > >     until either the edge in the opposite direction of the gravity is
> >> > > --
> >> > > 2.5.5
> >> > >
> >> > > _______________________________________________
> >> > > wayland-devel mailing list
> >> > > wayland-devel@lists.freedesktop.org
> >> > > https://lists.freedesktop.org/mailman/listinfo/wayland-devel  
> >>  
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/wayland-devel  

This is a good suggestion. I'll send a new patch which makes a statement about popups being at least adjacent to the parent in some way.