Skip to content

Fix X-style geometry parsing - #569

Draft
jholveck wants to merge 5 commits into
BoboTiG:mainfrom
jholveck:xgeom-fix
Draft

Fix X-style geometry parsing#569
jholveck wants to merge 5 commits into
BoboTiG:mainfrom
jholveck:xgeom-fix

Conversation

@jholveck

Copy link
Copy Markdown
Contributor

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.

  • Tests added/updated
  • Documentation updated
  • Changelog entry added - N/A
  • ./check.sh passed

AI assistance disclosure

  • No AI assistance was used to generate this contribution.

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.
@jholveck

Copy link
Copy Markdown
Contributor Author

This will need to be updated to conform to #566 , so it's not yet ready to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant