Prevent wl_surface.attach abuse
wl_surface.attach can be abused to arbitrarily move a surface on screen. Can we prevent this?
To answer this question, let's ask ourselves another question: what are the use-cases for
wl_surface.attach? It's used for client-side resizes, but how?
Some clients have a toolbar on the left and on the right, e.g.:
These toolbars can be toggled. It may be desirable to keep the work area (image editing area in the center) at the same position on screen when toggling a toolbar.
The client can just resize the buffer when toggling the toolbar on the right. But toggling the toolbar on the left requires compensating the position for the new buffer size.
In this use-case,
dx = old_width - new_width.
If the client decides to resize itself on its own but wants to stay centered (e.g. for a dialog), then it might want to set
dx = (old_width - new_width) / 2.
The compositor can't distinguish between legitimate uses and abuse.