Ignore stale client commits on floating resize - #9215
Open
jbms wants to merge 1 commit into
Open
Conversation
When a new view is mapped, criteria rules may configure its geometry (e.g. `resize set`). This configuration sends a new configure event to the client. However, during the map event handling, we are still processing the initial commit from the client. After the map event is handled and the rule-configured geometry is applied via a transaction, the compositor's commit handler (`handle_commit`) continues. For floating containers, `handle_commit` resizes the container to match the client's committed buffer size. If it processes the initial commit (which has the initial client size, not the configured one), it overrides the configured geometry back to the initial size. To fix this, we introduce `is_commit_stale` helper which checks if there is a pending or scheduled configure event with a newer serial than the serial acknowledged by the current commit. If the commit is stale, we ignore its size for resizing floating containers, waiting instead for the client to acknowledge and commit the newly configured size. How to reproduce: 1. Register the for_window rule: swaymsg 'for_window [title="Scratchpad Test"] move scratchpad, resize set 500 500' 2. Start the client: foot -T "Scratchpad Test" 3. Query the scratchpad window geometry: swaymsg -t get_tree | jq '.. | select(.name? == "__i3_scratch") | .floating_nodes[] | select(.name == "Scratchpad Test") | .rect' On buggy versions, this will output the client's default size instead of the configured 500x500.
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.
When a new view is mapped, criteria rules may configure its geometry (e.g.
resize set). This configuration sends a new configure event to the client.However, during the map event handling, we are still processing the initial commit from the client. After the map event is handled and the rule-configured geometry is applied via a transaction, the compositor's commit handler (
handle_commit) continues.For floating containers,
handle_commitresizes the container to match the client's committed buffer size. If it processes the initial commit (which has the initial client size, not the configured one), it overrides the configured geometry back to the initial size.To fix this, we introduce
is_commit_stalehelper which checks if there is a pending or scheduled configure event with a newer serial than the serial acknowledged by the current commit. If the commit is stale, we ignore its size for resizing floating containers, waiting instead for the client to acknowledge and commit the newly configured size.How to reproduce:
Register the for_window rule: swaymsg 'for_window [title="Scratchpad Test"] move scratchpad, resize set 500 500'
Start the client: foot -T "Scratchpad Test"
Query the scratchpad window geometry: swaymsg -t get_tree | jq '.. | select(.name? == "__i3_scratch") | .floating_nodes[] | select(.name == "Scratchpad Test") | .rect'
On buggy versions, this will output the client's default size instead of the configured 500x500.