Without this some window managers (e.g. fvwm) will ignore the initial
window position and place it according to it's own rules.
When using -g hint the WM that we've got user specified geometry
I do not understand why we have to set sizehints at all without the -g option given on the command line. Also, after looking at the diff of your commit, I'm not quite sure if it yields the same behaviour as before. Without testing your code, I'm quite confident, that the two if-conditions in lines 143 and 147 are always false.
Can you please tell me a bit more about your intent? Am I right assuming, that all you want, is to also set the gravity and the USPosition/USSize flags of the windows sizehints when the -g option is given on the command line?
I want to set USPosition and/or USSize if the user has specified a position and/or size with -g. The gravity was set to default to NorthWestGravity and change it if the user provided negative coordinates.
You're right that we don't have to set the sizehints if neither -g nor -F where given, so setting the sizehints would be a no-op. Of course we could check if win->sizehints.flags is not 0 and only then call XSetWMNormalHints(), e.g. in win_set_sizehints() or before calling win_set_sizehints().
According to the if-conditions in lines 143 and 147, they're true iff the if-condition in line 252 evaluates to true, i.e. -F was given. This should preserve the original behavior.
I will merge and refine your commit later. Regarding the if-conditions: the expression (X & Mask) == 1 is false for all Masks besides 1; according to <X11/Xuitl.h> both PMinSize and PMaxSize are a power of two greater than 1. So the correct conditionals should look like (X & Mask) == Mask.
(X & Mask) == 1
(X & Mask) == Mask
I see. Thanks for pointing that out!
I've merged your commit into my sizehints branch and slightly corrected/refined its changes. Can you please try it out and see if it works as expected?
Your changes work as expected, thanks for merging it.
Unfortunately your patch also introduced a minimum window size of 50x30 that wasn't expected. And now I'm really sad as I cannot display 16x11 icons without a huge gray border anymore.. :)
I've removed the window size checks. Is everything okay with you? Can I merge it into master?
For me now everything works as expected. Please feel free to merge it.
Merge branch 'sizehints', fixed issue #78