Gtkmm widgets don't always update...



I am making an application that allows a person to choose video sources for display on a main screen from a number of video widgets. The video widgets update at around 5 FPS, or should update, but I am having a hard time getting them to behave. For this application, I am using Glademm and gtkglextmm. I am using OpenGL inside these video widgets to do the rendering.

Allow me to cut to the chase here. I have two tables of video-showing buttons, one on the bottom and one on the side of the window. I can run video in the main screen and one button widget per table. The upper-leftmost button on each table gets invalidated and updated correctly, the rest just don't get their expose events.

The function I use to invalidate the widget from the producer thread is:

       void invalidate()
       {
               gdk_threads_enter();
               Gdk::Rectangle rect = get_allocation();
               get_window()->invalidate_rect(rect, false);
               gdk_flush();
               gdk_threads_leave();
       }

This function is called from within the OpenGL widget class, which is multiply inherited from Gtk::DrawingArea and Gtk::GL::Widget<OglWidget>. I place these widgets into two Gtk::Table widgets. It seems to me that only two widgets are being updated, and it depends upon their position in the table. I have found that only the one upper leftmost widget is being updated per table. I have tried various combinations of order of attachment, order of creation, attaching these widgets all in one row, or in multiple rows.


A code example should show what's going on at the top level:


       Gtk::Table* topsources;
       refXml->get_widget("top_vidsource_table", topsources);

       topsources->resize(2,2);
topsources->attach(*vb1->getBaseWidget(), 0, 1, 0, 1); // <- this display updates correctly vb1->getBaseWidget()->show_all(); // calls show_all() on the widget

       Gtk::Table* bottomsources;
       refXml->get_widget("bottom_vidsource_table", bottomsources);
       bottomsources->resize(4, 4);

VideoButton *vb2 = vbFactory.get_new_button(20004, "mpeg4", "videobutton.log"); VideoButton *vb3 = vbFactory.get_new_button(20006, "mpeg4", "videobutton.log"); VideoButton *vb4 = vbFactory.get_new_button(20008, "mpeg4", "videobutton.log"); VideoButton *vb5 = vbFactory.get_new_button(20010, "mpeg4", "videobutton.log");

bottomsources->attach(*vb4->getBaseWidget(), 1, 2, 0, 1); // <- this display fails to update correctly bottomsources->attach(*vb3->getBaseWidget(), 0, 1, 0, 1); // <- this display updates correctly bottomsources->attach(*vb5->getBaseWidget(), 2, 3, 0, 1); // <- this display fails to update correctly topsources->attach(*vb2->getBaseWidget(), 1, 2, 0, 1); // <- this display fails to update correctly

       vb2->getBaseWidget()->show_all();
       vb3->getBaseWidget()->show_all();
       vb4->getBaseWidget()->show_all();
       vb5->getBaseWidget()->show_all();



If I reconfigure the layout, I get different but equally dysfunctional results:

bottomsources->attach(*vb4->getBaseWidget(), 1, 2, 1, 2); // <- this display fails to update correctly bottomsources->attach(*vb3->getBaseWidget(), 1, 2, 0, 1); // <- this display updates correctly bottomsources->attach(*vb5->getBaseWidget(), 2, 3, 0, 1); // <- this display fails to update correctly topsources->attach(*vb2->getBaseWidget(), 1, 2, 0, 1); // <- this display fails to update correctly

If I leave only the uppermost cell empy, and not the entire column, I get the following:


bottomsources->attach(*vb4->getBaseWidget(), 1, 2, 0, 1); // <- this display fails to update correctly bottomsources->attach(*vb3->getBaseWidget(), 0, 1, 1, 2); // <- this display fails to update correctly bottomsources->attach(*vb5->getBaseWidget(), 2, 3, 0, 1); // <- this display fails to update correctly topsources->attach(*vb2->getBaseWidget(), 1, 2, 0, 1); // <- this display fails to update correctly

None of those update. It seems like the upper leftmost widget (or lack thereof) that's drawn gets the update if it is invalidated. The other widgets don't get any expose event when invalidated.

I think there may be a bug in the table widget. I have duplicated this issue in the simple little glgears program that was given as an example in the gtkglextmm documentation. Gtkglextmm maintainers, if you're listening, the glgears demo took some severe debuggering to get it to even compile.


Thank you for any assistance you may offer,

R Stoddard


Attachment: glgears.tgz
Description: Binary data



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