[sugar] multiple gtk.Windows hide() and show()

Carlos Neves cn
Mon Aug 27 17:35:09 EDT 2007

Dan Winship wrote:
> Erik Blankinship wrote:
>> Let me explain what I am trying to achieve: I am creating a "picture in 
>> a picture effect" (using XV in a window, amongst other windows).  GTK 
>> doesn't play well with overlapping widgets, and gtk.Fixed() doesn't 
>> guarantee Z-order.  So I am using a stack of gtk.Windows without 
>> decoration to achieve the desired effect, but the appearance is that 
>> everything looks like a nice gtk layout.
> Sorry, got confused by your description; I thought you were trying to 
> change stacking on the fly by swapping transient-fors around.
> But anyway, you still have the problem that "transient for" doesn't 
> actually mean anything having to do with stacking. (In fact, the ICCCM 
> lists a bunch of things a window manager might do differently with 
> transient windows, but stacking order isn't one of them.) So (1) setting 
> transient-for on a window won't necessarily affect its stacking, and (2) 
> it may affect it in ways other than stacking. (Eg, matchbox appears to 
> assume that any window that has WM_TRANSIENT_FOR set is a dialog box.)
> So your best bet is probably to make your own version of gtk.Fixed that 
> does have a guaranteed Z-order, rather than trying to bend the wm to 
> your will.
> Marco says "I seem to remember blizzard wrote something like that for 
> mozilla gtk2". You *might* also be able to get gtk.Fixed to work just by 
> calling raise()/lower() on the child widgets' GdkWindows to stack them 
> the way you want within the Fixed. (Or just by being sure to show() them 
> in bottom-to-top order.)
> -- Dan
> _______________________________________________
> Sugar mailing list
> Sugar at lists.laptop.org
> http://lists.laptop.org/listinfo/sugar

I hate to be the guy that starts the "I need that too" thread, but, 
well, I could use Fixed with zorder...

In an activity I'm developing, Jigsaw (you can check it out, it's on 
olpc's git) I use Fixed to manage the jigsaw pieces. Now, this presents 
a lot more work for the machine than the 'Draw your canvas' approach, 
but also makes the code 1000 times simpler to to and manage.

But I needed to move the piece being picked up to front, and the only 
way I could do this, short of writing my own Fixed version, was to 
unparent and readd the piece to the container. This has some side 
effects, made the dragging fail so I ended up doing that on piece 
release (looks funny sometimes but it works).

Of course this is only good to move the widget to the very top of the 
stack, you can't really set a specific position in the z axis...

I guess that cloning and extending gtk.Fixed should not be too hard, I 
just never got around to do it. I did a lot of specialized window 
managers in Java in the past, and it really wasn't that hard... I just 
don't have the time right now to take a go at this (and that is a good 
thing :) )

Just my 5 euro cents.


Carlos Neves

More information about the Sugar-devel mailing list