Any idea what might be causing such behavior
I think the values that you get are correct. You can see a shadow around the window (at least on the right and bottom side, but I bet that shadow is also present on the left and top). I bet that shadow is implemented by having a larger window and then making parts of it transparent.
So, the values that you get are correct, because they also include the shadow.
and how to mitigate it?
You could run xprop -frame
and/or xprop
in a terminal and then click on the window. Does GTK set some property that contain the size of the shadow? (I do not know the answer to this question; this is just a guess) (Is this even a GTK window?)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…