Re: frame size hints



Tom Tromey wrote:
"Havoc" == Havoc Pennington <hp redhat com> writes:


Havoc> I'm not sure exactly what AWT is doing with this information; I
Havoc> think it may support setting the size of the window including
Havoc> its frame.

There's a nice diagram here that might help:

    http://java.sun.com/j2se/1.4/docs/api/java/awt/Window.html

I do not see this diagram refering to WM frame in any way, neither it says anything about exact placement of the window on screen.


I don't know what Sun's implementation does under the hood.  But
basically in AWT all components are serializable; you can save and
restore them automatically.  The size and location of top-level
windows is no exception.  I hope this helps; I don't see where WM
decoration fits into the picture as a problem, but I assume it does.

Ok,  so the problem is saving and restoring position of the window.
It really is challenging and is affecting a broad range of apps even if they don't use AWT.

Thing is that you may not store frame position nor client position for future reuse. In case window manager config changes between uses - frame decor size will change as well and position restored from previously saved information will be wrong in this case.

Surely proposed approaches of storing frame size and allowing app to position it's frame window instead of client window could remedy such situation, but they both have a problem of not being compatible with overall X approach, as well as putting burden of adjusting position based on frame size on the app itself.

More effective and safer approach would be to continue on with traditional combination of Gravity hint and initial placement of the window. There is only one requirement that is needed to make it to work: There has to be a way to query the WM about client's withdrawn geometry, as well as EFFECTIVE gravity used by WM.

Say, when cliends needs that - it sends a message to WM requesting this information, and the WM upon receiving such message - calculates withdrawn position of the window, and sets a property on this window with :

X, Y, WIDTH, HEIGHT, BORDER_WIDTH and GRAVITY,

of such withdrawn position. Also whenever WM receives UnmapNotify signaling that client withdraws its window - it should set such property on client window anyway. Surely cliend could of queried its withdrawn position by using XGetGeometry, but there is one essential piece of info that could not be obtained that way - gravity value that has been used by WM to position the window.

Having above all this information about its withdrawn position, any clien could safely restore its position in future to the closest possible approximation, without concerning itself about WM frames, frame size, and any other external information, by simply setting its position prior to being mapped and using appropriate gravity in hints.


Sasha




Tom




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]