Fix X-style geometry parsing - #569
Draft
jholveck wants to merge 5 commits into
Draft
Conversation
X geometry lets you specify offsets from the right or bottom instead of top or left. Separately, it also lets you specify a region that's partially off-screen. I previously incorrectly implemented this. This fixes the implementation to be consistent with what XParseGeometry does. It also will crop the requested geometry to be within the root's bounds. This version has been hand-tested against how xlogo draws its window with all X geometry strings of the form 100x100+-25+-25, where each "+-" can independently be +, -, ++, +-, -+, or --. It's thus a reasonable reference implementation for _parse_coordinates, so I'm committing it here and now.
I'll probably delete this soon, and integrate it elsewhere.
It's extra complexity that's probably not needed.
It's just not worth a complete and correct explanation of XParseGeometry's handling of negative numbers.
Contributor
Author
|
This will need to be updated to conform to #566 , so it's not yet ready to merge. |
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.
Changes proposed in this PR
In #562, I had misinterpreted how negative numbers in X geometry strings are handled. As a result of this, I also broke the ability to pass negative top and left coordinates, which are valid on Windows and macOS.
This fixes the negative numbers to be consistent with XParseGeometry, and restores the ability to have negative top and left coordinates in both styles.
./check.shpassedAI assistance disclosure