justTony / pytyle

Automatically exported from code.google.com/p/pytyle
GNU General Public License v3.0
0 stars 0 forks source link

resizing, positioning, and geometry... oh my! #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This is a place for me to keep track of my thoughts regarding the problems 
surrounding window geometry, window position, and window resizing (and 
repositioning).

The endgame goal is the following:

x1, y1, w1, h1 = geometry()
move_resize(x1, y1, w1, h1)
x2, y2, w2, h2 = geometry()
x1 == x2 and y1 == y2 and w1 == w2 and h1 == h2

That is, we can grab the geometry of a window, issue a move_resize command to 
that window with the given geometry, and the window should not move and it 
should not change size. This is *difficult.*

The width and height of a window are affected by the window decorations. While 
the EWMH specifies a _NET_FRAME_EXTENTS property, it is not reliable. (Case in 
point, Openbox.) Namely, if decorations are removed from a single window, the 
_NET_FRAME_EXTENTS property still reports that the window has decorations.

Currently, I am using QueryTree and looking for a window's parent--it's "shell" 
per se. This window reports the *real* geometry of the window... And its 
coordinates don't need to be translated either. The problem with this approach 
is that it's not standard. What if a window manager doesn't re-parent? What if 
the values aren't what we expect?

Finally, the position of a window is also affected by the window's decorations.

Original issue reported on code.google.com by jamslam@gmail.com on 23 Sep 2010 at 10:24

GoogleCodeExporter commented 8 years ago

Original comment by jamslam@gmail.com on 24 Sep 2010 at 4:10

GoogleCodeExporter commented 8 years ago
Also note that I am current issuing a client event to the root window with the 
_NET_MOVERESIZE_WINDOW hint to resize and move windows. The benefit of this is 
to force a specific gravity (namely, NorthWest) when changing the position of a 
window.

This is especially helpful when certain windows specify a static gravity (i.e., 
OpenOffice).

What happens if a window manager doesn't support moving/resizing a window in 
this manner? We have to resort to ConfigureRequest--but that doesn't provide a 
means for specifying a gravity. That means we need to change the 
WM_NORMAL_HINTS (WM_SIZE_HINTS) property.

Original comment by jamslam@gmail.com on 24 Sep 2010 at 4:14