Floating window restores its old size if it receives a new configuration without a specified size
Steps to reproduce
GNOME with mutter 41.3:
- open two windows, such as gnome-terminal
- open looking glass
- resize one of the window using move_resize_frame, like
global.display.focus_window.move_resize_frame(true, 0, 0, 500, 500)
- close looking glass
- click other window to move focus
Current behavior
The programmatically moved window restores its old size.
Expected outcome
The size shouldn't get restored.
Additional information
See mutter#2091 (closed) for more information/context by skeller.
Quoting him with links adjusted
Like said in mutter#2023 (closed), this seems to have exposed what I would consider a bug in gtk: gtk stores the window size when the window is getting fullscreened/maximized/tiled and then restores the window size if it receives a new configuration without a specified size if the window is not fullscreened/maximized/tiled. Since mutter@8c6b3e03 configurations for focus changes do not set a size anymore, because the code now correctly does not consider floating windows as fixed size anymore. So what happens in gtk is that it restores some old saved size when it receives the configuration for the focus change.
There are two ways of fixing this:
- In gtk itself by not trying to restore the size based only on the new window state, but also by looking at the previous window state. So basically only restore the window size when the window got unfullscreened/unmaximized/untiled. Otherwise it would also be restoring window sizes on focus changes, which I don't think makes much sense.
- On the mutter side by also sending a size when changing the window state. This can be done to avoid regressions with toolkits that show the broken behavior (afaik only gtk).
Ideally we would do both, but in my opinion the bug is in gtk and the mutter change would be more of a workaround.
As for reverting 8c6b3e032620d35cb44d990ca9ebdc3b0aaac01d, this could be done in 41, because while correct, there is no visible issue fixed by this change since the changes depending on it (mutter!2103 (merged)) have not been backported yet. The backport is probably going to happen for 41.3 though and by that time there probably is a mutter side workaround to go along with it, so reverting it upstream wouldn't make much sense. Distros can probably revert it until then though.
This is roughly what I think the gtk3 patch should look like: gtk3-fix-wayland-window-size-restore.patch
jadahl since you are more familiar with the spec, do you agree with this or is it mentioned somewhere that the compositor is obliged to include a size in status change configures?