[Glade-users] reparenting a GtkDrawingArea with OpenGl

Both windows need to be displayed, but they swap positions when the user
wants.  The left box is a lot bigger, so it's a way to change the focus from
the map to the picture. I've thought of a couple of work arounds:

1) I could completely destroy, and redraw the object, but that seems like
it's a waste, and I'd have to cache the information that's being drawn in a
second place.

2) I could create two copies of each, but them in vbox's and then just
change which one is hidden. So at startup the left map and right pic are not
hidden, and then when the user switches, the right map and left pic are not
hidden.  Seems like even more of a waste.

On Fri, May 15, 2009 at 2:42 PM, Tristan Van Berkom <
tristan.van.berkom at gmail.com> wrote:

Out of curiosity, does it work if you use a notebook parent with hidden
tabs ?
the notebook is slightly different as it remaps the child widgets and
them once, only careful you may get bitten by the fact that the
invisible notebook
pages are never realized/mapped until shown.


On Fri, May 15, 2009 at 4:01 PM, Jeff Eberl <jeffeb3 at gmail.com> wrote:
I have  a window with two GtkDrawingArea's.  One is a map and one is a
picture, I'm trying to swap the two windows with the click of a button.
Surrounding each drawing is a bunch of buttons and things.

This is how I reparent them:


gtk_container_remove(left_container, map_widget);
gtk_container_remove(right_container, pic_widget);

gtk_container_add(left_container, pic_widget);
gtk_container_add(right_container, map_widget);


The buttons, the boxes, and everything in the widgets swaps out, but the
next time I try to draw in either of them, the gdk_gl_drawable_gl_begin

GdkGKExt-CRITICAL **: gdk_gl_window_impl_x11_make_context_current:
'GDK_IS_GL_CONTEXT_IMPL_X11 (glcontext)' failed

So, that's a bummer.  I didn't write the code I'm using to instantiate
widgets, or draw the pic/map.  I'm wondering if maybe the problem is that
the "realize" event gets called twice, but all the gdk setup stuff is
actually in a different method, one that doesn't get called twice.  The
realize callback doesn't really have anything in it.

Any help would be appreciated.  I'm running in circles.


Glade-users maillist  -  Glade-users at lists.ximian.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20090515/12e9428d/attachment.html 

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