Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable position feature #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Enable position feature #5

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Oct 8, 2019

Use sscanf() to parse X geometry strings.

ld_liaomo added 2 commits October 8, 2019 18:44
The original compile command doesn't work with gcc 7.3.0. It works well
after shuffling the options.
Use sscanf() to parse X geometry string. It seems to be working :) .
@tie
Copy link
Owner

tie commented Oct 8, 2019

I’m not sure about the actual behavior, but the XParseGeometry(3) clearly states that “items in [] (square brackets) are optional”.

I think OK to omit the [=] (optional leading equal sign) from the format as it’s probably for convenience of parsing geometry specification as program argument, i.e. the code can process {"-geom=0x0-0+0"} and {"-geom", "0x0-0+0"} without an extra branch for =. It’s just a guess though, so don’t quote me on that.

But the “unused” [<width>{xX}<height>] is optional, and I don’t think that scanf syntax is expressive enough to parse a set of optional variables (and we have regular expressions for these kind of things anyway). That said, the valid geometry that proposed scanf format cannot parse is -1+1XOffset = -1, YOffset = 1. You could try it out in a standalone program.

I apologize if you were confused by the FIXME comment lacking details of the issue. It means that width and height variables are unused and we should (probably) do something about it, e.g. use them for some purpose.

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.

None yet

1 participant