<div dir="ltr"><div><div><div><div>Pekka I think you misunderstod my point, let me try to be more clear.<br></div>The "circular menu" is actually just a window, that paints some icons on a ring. It doesn't have a parent window, and that's the problem.<br>
</div>How in Wayland will we be able to place this window so that its center is right on the cursor position ?<br></div>We know the mouse position only relatively to a surface, but here we need the mouse position on the screen, and then positionning the window relatively to it.<br>
</div>In short, you press the shortkey, and then a ring of icons appear scentered on the cursor. The question is "how?"<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-01 21:42 GMT+02:00 Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Tue, 1 Jul 2014 20:52:28 +0200<br>
Fabrice Rey <<a href="mailto:fabounet03@gmail.com">fabounet03@gmail.com</a>> wrote:<br>
<br>
> Here is another problem (and sorry for my numerous messages,<br>
> I've just though of this one now) :-)<br>
> I have an application that pops up a menu when pressing a shortkey.<br>
> It's a circular menu (it actually really exists such an application), so it<br>
> should pop with its center right on the cursor.<br>
> So here we don't need global coordinates, but to tell the compositor to<br>
> place the window relatively to the cursor.<br>
> Since there is only the possibility to place a window relatively to its<br>
> parent, how would we achieve a good placement ?<br>
<br>
</div>The app already knows the position of the cursor on the (parent)<br>
window, so just calculate from that. Simple.<br>
<br>
If the cursor is not on the window, there is no position available.<br>
In that case you'd better center that menu on the widget it is<br>
related to. Spawning the menu completely elsewhere than where the<br>
window is would seem confusing to me.<br>
<div class=""><br>
> By the way, we can also assume that the menu can also be a regular<br>
> rectangular menu (depending on a parameter in its configuration), in which<br>
> case the application may want to display its window above the cursor (like<br>
> when you right-click on the desktop).<br>
> This case is easy for the compositor (no constraint from the application,<br>
> relative position = (0;0)), it's just to show that the application should<br>
> be able to dynamically modify the relative position, with possibly any<br>
> value.<br>
<br>
</div>Sorry, I don't understand what the problem here could be.<br>
<br>
The app chooses the position of the menu surface, relative to the<br>
parent window. If you have a pointer above that window, you also<br>
know where the pointer is on that window. Child surfaces like menus<br>
are positioned by x,y relative to the parent.<br>
<br>
What we were discussing below was about positioning top-level<br>
windows or windows that have no related parent, and so they do not<br>
have any reference on where to position them.<br>
<br>
Also, a client is in total control of all the child surfaces it may<br>
use, that is, it knows all the siblings of all the surfaces it can<br>
explicitly position. That is not the case for top-level windows, as<br>
a client does not know about any other clients or their windows.<br>
<br>
<br>
Thanks,<br>
pq<br>
<div class="HOEnZb"><div class="h5"><br>
> 2014-07-01 8:36 GMT+02:00 Pekka Paalanen <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>>:<br>
><br>
> > Hi, please use reply-to-all.<br>
> ><br>
> > On Tue, 1 Jul 2014 00:21:51 +0200<br>
> > Fabrice Rey <<a href="mailto:fabounet03@gmail.com">fabounet03@gmail.com</a>> wrote:<br>
> ><br>
> > > Thank you both for your constructive explanations.<br>
> > ><br>
> > > > "You are thinking in X11 terms now"<br>
> > > I'm afraid; still, we'll probably have to think of some similar hints as<br>
> > > "skip_taskbar/skip_pager", because there will be some windows we don't<br>
> > want<br>
> > > to see in the list of windows.<br>
> ><br>
> > I think that may be solved by window types/roles more than having one<br>
> > generic "normal window type" with flags or state for everything.<br>
> ><br>
> > Just like a normal top-level window right now is an xdg_surface, and a<br>
> > menu, combobox, etc. is an xdg_popup which is characterized by having<br>
> > an input grab. xdg_surface seems to have a "flag" set with the<br>
> > set_transient_for request that makes it behave differently and skip<br>
> > taskbar and pager.<br>
> ><br>
> > Whether new things would be flags for a normal top-level window or a<br>
> > new window type needs to be decided on a case by case basis. We want<br>
> > semantics in the protocol and policy in the compositor, rather than<br>
> > just mechanisms in the protocol like X11.<br>
> ><br>
> > > > "Btw. what if you start two desklets? Both go in the same corner? On<br>
> > > top of each other? Do you need to manually configure each desklet<br>
> > > to go in a different corner?"<br>
> > > well the user just positions them wherever he wants, even if it's one of<br>
> > > top of the other, and then they should stay like that. Ultimately, the<br>
> > user<br>
> > > should be able to decide where his windows are, who does the job is of no<br>
> > > importance to him. I was just concerned whether it would be possible or<br>
> > not.<br>
> ><br>
> > For desklets, the actual mechanism might depend on the DE. At least if<br>
> > the compositor does the placement, it will not get too messed up if the<br>
> > configuration of outputs changes and in many cases would be just right.<br>
> > Also the DE may have its own pieces that need to arrange properly with<br>
> > your desklets.<br>
> ><br>
> > If you talking about recalling the position of any usual application<br>
> > windows, that is a totally different matter.<br>
> ><br>
> > > About the rest, I can see now where you're going; seems attractive, I<br>
> > just<br>
> > > hope the various compositors can really handle the job.<br>
> > > Do you have any detail on how it will be implemented ? like how do you<br>
> > > place 2 windows of the same application ? obviously you can't rely on the<br>
> > > class to distinguish both, the name may change over time, ... you're not<br>
> > > even sure they will be created in the same order.<br>
> > > The desklets was just an example; say I have small script that pops 4<br>
> > > xterms to fill my screen, each with different options. So IIUC, contrary<br>
> > to<br>
> > > X I can't place them where I want automatically but I can place them<br>
> > > manually and the compositor will remember the positions for the next<br>
> > time.<br>
> > > What to I need to do so that this is possible ?<br>
> ><br>
> > You need to create a new (desktop-specific?) protocol extension, that<br>
> > allows the client and the compositor to cooperate on saving and<br>
> > restoring window positions, sizes, etc. No-one AFAIK has gotten to it<br>
> > yet.<br>
> ><br>
> > One idea was that the client can ask the compositor to create a<br>
> > cookie (a blob) that the client can save, and when restoring the<br>
> > window, give the cookie back to the compositor to recall the position<br>
> > and size, subject to the compositor checking if it makes sense<br>
> > (e.g. avoid putting windows in unreachable places) and adjusting as<br>
> > necessary. It is a blob rather than (x,y,w,h,a,r,g,...) tuple, so that<br>
> > different compositors can save all the compositor-specific data too,<br>
> > like rotation angles. Also, the blob is to prevent clients from abusing<br>
> > the recall mechanism to position windows in global coordinates. But<br>
> > that's just one idea.<br>
</div></div></blockquote></div><br></div>