Resizing child windows
Carsten Haitzler (The Rasterman)
raster at rasterman.com
Tue Sep 4 15:28:48 PDT 2007
On Tue, 4 Sep 2007 10:20:25 -0500 matthew.garman at gmail.com babbled:
> On Fri, Aug 31, 2007 at 07:58:49AM +0900, Carsten Haitzler wrote:
> > the window hierarchy is irrelevant. it's the widget hierarchy that
> > counts. a widget may or may not map to a window. widget != window.
> Yeah, I don't think I asked the question very clearly, but think I
> got the idea anway.
> Even though window != widget, I was making the assumption that all
> (or at least most) widgets are implemented around an X11 Window (or
> at least Drawable). So with that (incorrect) assumption in mind, I
> was trying to figure out if every single widget (and window by
> implication) needed to be tied to xevents.
definitely was incorrect to assume :) gtk and qt and motif and xt have child
windows - i can say for certain that ewl and etk have zero child windows -
nothing at all except the main window for the app window. you need events.
otherwise how do you know whjat the mouse or keyboard is doing - but how you
route and marshall events can vary from widget set to widget set.
> So I think now the better way to look at this is to have generally
> only one "thing" (widget or some other construct) that can catch X
> events (at least dealing with resize), and from there dispatch
> instructions (or at least hints) to all other widgets in the
> collection. How the "thing" communicates with the other widgets is
> a matter of implementation detail (and not necessarily dependant on
all widgets sets will do this as a matter of sheer efficiency. there is no
point going to and fro from x when a single reconfigure event on the main app
window is all you need. any sub windows - if any, are 100% app controlled thus
no need to wait for x to tell you something resized - you know it did, because
you did it. the exception here is if you swallow foreign windows as part of
your widget set (and in that case you just do what wm's do and redirect map and
configure requests thus you get an x event requesting a map or configure and
you handle it as you see fit).
> If you can make sense of what I wrote... does that sound more
more :) personally i'd suggest avoiding subwindows entirely. drop them.
interesting idea for efficiency - tyring to only process the events u need (eg
mouse motion events) in the regions you need to, but in the end it's easier
just to blindly listen to all move events on your window and marshall events
yourself to the right widgets. on a main window resize queue a "figure out how
to lay all my widgets out" job. process this when you go idle and are about to
sit and wait for more events.
> Thanks again,
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler) raster at rasterman.com
Tokyo, Japan (東京 日本)
More information about the xorg