Open ghost opened 5 years ago
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+1
⇒ XOffset = -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.
Use sscanf() to parse X geometry strings.