Conversation
`set_min_surface_size` and `set_max_surface_size` stored the sizes with the decoration borders added, so `reload_min_max_hints` added the borders a second time. `set_resizable(false)` also overwrote the stored sizes with the current size, so the window stayed fixed at that size after `set_resizable(true)`. Store the sizes as requested, as X11 does, and let `reload_min_max_hints` alone build the hints, adding the borders and fixing both hints to the current size while not resizable. Unlike X11, a limit set while not resizable is now only sent once the window is resizable again. Sending it straight away would replace one of the two fixed hints, either letting the window resize or putting the minimum above the maximum. The stored minimum is no longer clamped to `MIN_WINDOW_SIZE`, so clamp the size snapped to resize increments instead.
The hints were sent before the frame existed and never re-sent, so they left out the titlebar and went stale when fullscreen or decorations changed the borders. Reload them on every resize. A non-resizable window is pinned to its stateless size, so maximizing it does not move the pin. Changing the decoration mode now also resizes, so the window geometry and hints follow the frame being added or removed.
Increments were aligned from the internal `2x1` minimum, so an aligned `w x h` with increments `a x b` snapped to `(w - a + 2) x (h - b + 1)`. Align from the requested minimum, or from zero, and round a size below one increment up to the first aligned size.
The configure that clears `RESIZING` was not snapped, so releasing the mouse returned the window to the unaligned pointer-derived size. Also snap the configure that follows a resize.
An increment of `0` panicked with a division by zero on the first snapped configure. Treat it as `1`, which constrains nothing.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4713
Fixes #4715
Having a go at fixing my above bug reports; this PR fixes all problems I listed on those two issues, tested in the same way.
Notable changes
A minimum or maximum size set while not resizable now waits for
set_resizable(true), where X11 sends it straight away.invalid_size).A window made non-resizable while maximized is fixed to the size it restores to, and maximizing a non-resizable window does not change this.
With no requested minimum, a surface is never smaller than one increment. Before, an axis below one increment fell to
2x1.5x5request with10x20increments now opens at10x20instead of2x1.A zero increment counts as
1on that axis rather than panicking. Windows ignores both increments if either is zero, and macOS clamps each axis to1when set but ignores both at window creation, so this is a best guess.The hints are sent on every resize, including each configure of a drag.
set_decorateand decoration mode changes can add or remove.resizealready sends the window geometry, opaque region, blur and viewport each time, so the hints aren't cached either.Tested on all platforms changed
Added an entry to the
changelogmodule if knowledge of this change could be valuable to usersUpdated documentation to reflect any user-facing changes, including notes of platform-specific behavior
Created or updated an example program if it would help users understand this functionality