Window placement

Bill Spitzak spitzak at
Tue Jul 1 12:57:19 PDT 2014

On 07/01/2014 11:52 AM, Fabrice Rey wrote:
> Here is another problem (and sorry for my numerous messages,
>   I've just though of this one now) :-)
> I have an application that pops up a menu when pressing a shortkey.
> It's a circular menu (it actually really exists such an application), so
> it should pop with its center right on the cursor.
> So here we don't need global coordinates, but to tell the compositor to
> place the window relatively to the cursor.
> Since there is only the possibility to place a window relatively to its
> parent, how would we achieve a good placement ?

When the keyboard and mouse focus are the same surface then relative 
coordinates for the popup can be used. This will more accurately place 
the menu where the mouse was when the shortcut was pressed, rather than 
a race condition where the mouse may have moved some since the shortcut 
was sent to the client.

I'm not sure what to do if they are different surfaces. Apps that work 
this way (for instance the Space bar in Maya) tend to work best in 
point-to-type mode so they are always the same surface. Possibly this 
means the keyboard focus surface needs to get all the move events.

More information about the wayland-devel mailing list