Re: Gtkmm widgets don't always update...



I figured it out, all thanks to the fact that gtkglextmm wouldn't build on my machine at home. That twisted my arm to find another demo that would work on that machine. The reason why the glgears demo wouldn't work, and consequently, since I modelled the OpenGL portions of the code for my application off of the glgears demo, is because of this little piece of code:

void invalidate() {
   Gdk::Rectangle allocation = get_allocation();
   get_window()->invalidate_rect(allocation, false);
 }

The problem here is that the allocation rect that is delivered has the position, width and height of the widget with respect to the parent widget. This, however, asks Gtk/Gdk to invalidate the rect with respect to the widget's coordinates, which causes the widget to not update because it has no content in that area. The correct code would/should have been:

void invalidate() {
Gdk::Rectangle allocation(0,0, get_allocation().get_width(), get_allocation().get_height());
   get_window()->invalidate_rect(allocation, false);
 }




Thank you for your time and attention,

Rob Stoddard


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