Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

x11 - xcb_get_geometry_reply returns slightly larger window geometry then the real window on Gnome

I have a method that's supposed to return position and size of the active window. Works find on Plasma for example but on Gnome the geometry is a little bit larger then the real window as seen on this screenshot:

enter image description here

I'm using xcb_get_geometry_reply to fetch the window information. Any idea what might be causing such behavior and how to mitigate it?

question from:https://stackoverflow.com/questions/65863017/xcb-get-geometry-reply-returns-slightly-larger-window-geometry-then-the-real-win

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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?)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...