xdg-shell: xdg_toplevel.configure event bundles size and states
The xdg_toplevel.configure
event bundles two unrelated things: width
/height
, and states
.
This is an issue because compositors have no way to change the state without reconfiguring the size. For instance:
- The compositors sends an initial
configure(300, 300, [])
- Later, the client resizes to 200x200
- Later, the user switches focus and the compositor wants to add the
activated
state
Should the compositor send configure(200, 200, [activated])
? This is racy if the client resizes at the same time, and conceptually the compositor doesn't really prefer 200x200, it just happens to be the current toplevel size.
Should the compositor send configure(0, 0, [activated])
? Since 0x0 is defined as "client decides", maybe the client will react to this by resizing, for instance because the current size is not the "natural size" for the content (e.g. the widgets in the toplevel are a bit too constrained, or the toplevel size doesn't match the aspect ratio of the content, etc).
One way to fix this would be to specify that 0x0 means "keep current size" if the toplevel is mapped. However, this doesn't work well when removing the maximized state (client should pick the "natural size" in this case), and the compositor might really want to have a way to unset its "preferred size".
Another way to fix it would be to introduce two separate events, configure_size
and configure_states
, then deprecate the configure
event.