[Perlplusplugin-developers] More on X-events
Status: Beta
Brought to you by:
fholtry
From: Frank H. <fh...@av...> - 2000-09-19 14:10:40
|
Dmitry, Here's the Perl program I was using to learn how X works and to experiment with preserving a window while Netscape resizes. The idea was to trap the ResizeRedirect and SubstructureNotify events before the destroy happened, reparent the window and it's descendants outside the Netscape heirarchy and then reparent them back into the heirarchy once Netscape had settled down from the resize. Note that I view trees of this sort as inverted, so the root node is at the top and the leaves are at the bottom. 'Up' means toward the root node and 'down' means toward the leaves. Yesterday, I indicated that events propagate up the tree, but I think that's incorrect. Most event notifications are propagated down the tree, so I set masks on windows a few levels above the embedded window. However, destroys happen from the bottom up, obviously. This code successfully preserves the Perl/Tk windows most of the time, but not quite all the time. I attribute this to the fact that it sometimes loses the race with the X-server, but I don't know a way yet to prove that's what happens. An alternative to this approach is to have the Perl program detect the destruction of it's children and reconstruct them. I haven't experimented with this yet. It might be tricky for windows displaying rapidly changing data -- scrolling text, for example -- since you'd want to restore to the exact place in the text where the destroy occurred. Maybe widgets could be designed to respond to X-events and preserve enough state to make such reconstructions easier. -- ------------------------------------------------------------------------------- | Frank Holtry | "If you have the right attitude, interesting | | fh...@av... | problems will find you." | | | Eric S. Raymond | ------------------------------------------------------------------------------- |