Change (GLArea) widget's parent without unrealizing said widget

Hi, I am developing a terminal emulator using GTK and GLArea widget. I want to implement pane-splitting using the GTK Paned widget (sort of like Terminator does it). Note that all the OpenGL related objects are created and initalized, when the GLArea widget is realized (important later). I currently have the following code:

When the application starts, only a single GLArea widget (terminal) is created and set as the Window child. When the user splits the terminal, a new Paned widget is created, the already created GLArea widget is added as the start child of the Paned widget and a new GLArea terminal is added as the last child of Paned. Paned widget is then set as the window child (replacing the original GLArea).
Pane splitting works as intended and the original GLArea terminal is reused during split.

However. When I remove the original GLArea terminal from Window and set it as child of Paned, the GLArea is first unrealized, then realized again after it is set as child of Paned. Since OpenGL objects are freed when unrealize callback is called, and allocated when realize callback is called, this leads to a reset of the OpenGL state. All the OpenGL objects, buffers, textures, etc. are unloaded and loaded with unrealize and realize, even though the GLArea simply switched parents. This is very wasteful I think.

Is there any way I can switch GLArea parent (from Window to Paned) without realize and unrealize being called (and all the OpenGL state reset)? Any workaround?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.