<div dir="auto"><div>Hi,<div dir="auto"><br></div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 8, 2022, 9:27 AM samuel ammonius <<a href="mailto:sfammonius@gmail.com">sfammonius@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I started a discussion a while ago about the possibility of adding position set/get abilities to wayland, but since then I'd learned alot about how wayland works. I had heard that wayland combines the WM and server into one "compositor", but I thought wayland itself still managed some things. Since then I've learned that the compositor manages every event that a wayland client sends, and I think this makes the ability to set/get a position even more necessary. </div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">On top of that, the end user (a human sitting behind the monitor) can reconfigure everything, because "we all know better and computers are dumb".</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>The reasons are:<div><ol><li>Apps can send both the position they want for a window and and the type of window, and a compositor can choose which one to follow. (for example, a client can send (width/2, height/2) and "popup" for a popup surface, and compositors that prefer to follow the descriptive design will follow "popup" and ones that prefer prescriptive design will follow the coordinates).</li><li>Waylands asynchronous event system means that a compositor can ask users if they would like to give an app permission to move itself and/or other windows, similar to how android asks before giving apps camera/GPS permissions.</li></ol><div>I've looked at existing wayland protocols and used them to create a simple one for position set/get.</div></div><div><pre lang="xml">------------------------------------------------------------------------------------------</pre><br></div><div><pre lang="xml"><span id="m_-5368154962994004206gmail-LC1" lang="xml"><span><?xml version=<span>"1.0"</span> encoding=<span>"UTF-8"</span>?></span></span>
<span id="m_-5368154962994004206gmail-LC2" lang="xml"><span><<span>protocol</span> <span>name</span>=<span>"pos_unstable_v1"</span>></span></span>
<span id="m_-5368154962994004206gmail-LC4" lang="xml">  <span><<span>copyright</span>></span></span>
<span id="m_-5368154962994004206gmail-LC5" lang="xml">    Copyright © 2022 Samuel Ammonius</span>
<span id="m_-5368154962994004206gmail-LC6" lang="xml"></span>
<span id="m_-5368154962994004206gmail-LC7" lang="xml">    Permission is hereby granted, free of charge, to any person obtaining a</span>
<span id="m_-5368154962994004206gmail-LC8" lang="xml">    copy of this software and associated documentation files (the "Software"),</span>
<span id="m_-5368154962994004206gmail-LC9" lang="xml">    to deal in the Software without restriction, including without limitation</span>
<span id="m_-5368154962994004206gmail-LC10" lang="xml">    the rights to use, copy, modify, merge, publish, distribute, sublicense,</span>
<span id="m_-5368154962994004206gmail-LC11" lang="xml">    and/or sell copies of the Software, and to permit persons to whom the</span>
<span id="m_-5368154962994004206gmail-LC12" lang="xml">    Software is furnished to do so, subject to the following conditions:</span>
<span id="m_-5368154962994004206gmail-LC13" lang="xml"></span>
<span id="m_-5368154962994004206gmail-LC14" lang="xml">    The above copyright notice and this permission notice (including the next</span>
<span id="m_-5368154962994004206gmail-LC15" lang="xml">    paragraph) shall be included in all copies or substantial portions of the</span>
<span id="m_-5368154962994004206gmail-LC16" lang="xml">    Software.</span>
<span id="m_-5368154962994004206gmail-LC17" lang="xml"></span>
<span id="m_-5368154962994004206gmail-LC18" lang="xml">    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span>
<span id="m_-5368154962994004206gmail-LC19" lang="xml">    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span>
<span id="m_-5368154962994004206gmail-LC20" lang="xml">    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL</span>
<span id="m_-5368154962994004206gmail-LC21" lang="xml">    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span>
<span id="m_-5368154962994004206gmail-LC22" lang="xml">    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span>
<span id="m_-5368154962994004206gmail-LC23" lang="xml">    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span>
<span id="m_-5368154962994004206gmail-LC24" lang="xml">    DEALINGS IN THE SOFTWARE.</span>
<span id="m_-5368154962994004206gmail-LC25" lang="xml">  <span></<span>copyright</span>></span></span></pre><pre lang="xml"><pre lang="xml"><span id="m_-5368154962994004206gmail-LC27" lang="xml"><span><<span>interface</span> <span>name</span>=<span>"zwp_pos_v1"</span> <span>version</span>=<span>"1"</span>></span></span>
<span id="m_-5368154962994004206gmail-LC28" lang="xml">    <span><<span>description</span> <span>summary</span>=<span>"position management protocol"</span>></span></span>
<span id="m_-5368154962994004206gmail-LC29" lang="xml">      Used to set/get the position of a surface. The ability to set the monitor that a surface is on is not available yet.</span></pre><pre lang="xml"><span lang="xml"><br></span></pre><pre lang="xml"><span id="m_-5368154962994004206gmail-LC44" lang="xml">      Warning! The protocol described in this file is experimental and</span>
<span id="m_-5368154962994004206gmail-LC45" lang="xml">      backward incompatible changes may be made. Backward compatible changes</span>
<span id="m_-5368154962994004206gmail-LC46" lang="xml">      may be added together with the corresponding interface version bump.</span>
<span id="m_-5368154962994004206gmail-LC47" lang="xml">      Backward incompatible changes are done by bumping the version number in</span>
<span id="m_-5368154962994004206gmail-LC48" lang="xml">      the protocol and interface names and resetting the interface version.</span>
<span id="m_-5368154962994004206gmail-LC49" lang="xml">      Once the protocol is to be declared stable, the 'z' prefix and the</span>
<span id="m_-5368154962994004206gmail-LC50" lang="xml">      version number in the protocol and interface names are removed and the</span>
<span id="m_-5368154962994004206gmail-LC51" lang="xml">      interface version number is reset.</span>
<span id="m_-5368154962994004206gmail-LC52" lang="xml">    <span></<span>description</span>></span></span>
<pre lang="xml"><span id="m_-5368154962994004206gmail-LC238" lang="xml">    <span><<span>request</span> <span>name</span>=<span>"set_pos"</span>></span></span>
<span id="m_-5368154962994004206gmail-LC239" lang="xml">      <span><<span>description</span> <span>summary</span>=<span>"position setter"</span>></span></span>
<span id="m_-5368154962994004206gmail-LC240" lang="xml">      </span>Set the position of a surface
<span id="m_-5368154962994004206gmail-LC247" lang="xml">      <span></<span>description</span>></span></span>
<pre lang="xml"><span id="m_-5368154962994004206gmail-LC144" lang="xml">      <span><<span>arg</span> <span>name</span>=<span>"surface"</span> <span>type</span>=<span>"object"</span> <span>interface</span>=<span>"wl_surface"</span></span></span>
<span id="m_-5368154962994004206gmail-LC145" lang="xml">         <span>summary</span>=<span>"target surface"</span>/></span>
</pre><pre lang="xml"><span id="m_-5368154962994004206gmail-LC144" lang="xml">      <span><<span>arg</span> <span>name</span>=<span>"x"</span> <span>type</span>=<span>"int"</span></span></span><span id="m_-5368154962994004206gmail-LC145" lang="xml">/></span></pre><pre lang="xml"><span id="m_-5368154962994004206gmail-LC144" lang="xml">      <span><<span>arg</span> <span>name</span>=<span>"y"</span> <span>type</span>=<span>"int</span></span></span><span id="m_-5368154962994004206gmail-LC145" lang="xml"><span>"</span>/></span></pre><span id="m_-5368154962994004206gmail-LC250" lang="xml">    <span></<span>request</span>></span></span>
<span id="m_-5368154962994004206gmail-LC251" lang="xml"></span>
<span id="m_-5368154962994004206gmail-LC252" lang="xml">    <span><<span>event</span> <span>name</span>=<span>"pos_changed"</span>></span></span>
<span id="m_-5368154962994004206gmail-LC253" lang="xml">      <span><<span>description</span> <span>summary</span>=<span>"position changed event"</span>></span></span>
<span id="m_-5368154962994004206gmail-LC254" lang="xml">      </span>Notification that a surface has been moved, either by itself, another program, or the compositor.</pre><pre lang="xml">        WARNING: Do not use this event to force a surface to a certain position. If multiple apps want the surface in a different position, then the computer may freeze or glitch.</pre><pre lang="xml"><span id="m_-5368154962994004206gmail-LC255" lang="xml">      <span></<span>description</span>></span></span></pre><pre lang="xml"><span lang="xml"><span><pre lang="xml"><pre lang="xml"><span id="m_-5368154962994004206gmail-LC144" lang="xml">      <span><<span>arg</span> <span>name</span>=<span>"x"</span> <span>type</span>=<span>"int"</span></span></span><span id="m_-5368154962994004206gmail-LC145" lang="xml">/></span></pre><pre lang="xml"><span id="m_-5368154962994004206gmail-LC144" lang="xml">      <span><<span>arg</span> <span>name</span>=<span>"y"</span> <span>type</span>=<span>"int</span></span></span><span id="m_-5368154962994004206gmail-LC145" lang="xml"><span>"</span>/></span></pre></pre></span></span></pre><pre lang="xml"><span id="m_-5368154962994004206gmail-LC256" lang="xml">    <span></<span>event</span>></span></span>
</pre><pre lang="xml"><span lang="xml"><span><pre lang="xml"><pre lang="xml"><span id="m_-5368154962994004206gmail-LC252" lang="xml">    <span><<span>event</span> <span>name</span>=<span>"get_pos"</span>></span></span><br></pre><pre lang="xml"><span lang="xml"><span><pre lang="xml"><pre lang="xml"><span id="m_-5368154962994004206gmail-LC144" lang="xml">      <span><<span>arg</span> <span>name</span>=<span>"x"</span> <span>type</span>=<span>"int"</span></span></span><span id="m_-5368154962994004206gmail-LC145" lang="xml">/></span></pre><pre lang="xml"><span id="m_-5368154962994004206gmail-LC144" lang="xml">      <span><<span>arg</span> <span>name</span>=<span>"y"</span> <span>type</span>=<span>"int</span></span></span><span id="m_-5368154962994004206gmail-LC145" lang="xml"><span>"</span>/></span></pre></pre></span></span></pre><pre lang="xml"><span id="m_-5368154962994004206gmail-LC256" lang="xml">    <span></<span>event</span>></span></span></pre></pre></span></span></pre>  </interface></pre><pre lang="xml"></protocol></pre><pre lang="xml">------------------------------------------------------------------------------------------</pre><pre lang="xml">Should I just send it or is my reasoning (or XML syntax) wrong?</pre></pre></div></div></div>
</blockquote></div></div></div>