oneko icon indicating copy to clipboard operation
oneko copied to clipboard

Enable position feature

Open ghost opened this issue 5 years ago • 1 comments

Use sscanf() to parse X geometry strings.

ghost avatar Oct 08 '19 11:10 ghost

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.

tie avatar Oct 08 '19 15:10 tie