Reputation: 921
I need to know when a GtkWidget was redrawn and validated after I change it's content (schedule a redraw).
Is anyway to get whether it's redrawn complete or need to wait more to get redrawn.
Upvotes: 0
Views: 42
Reputation:
The way to get around what you need is to delay the scroll until GTK knowns how big the scroll area is. Probably the easiest way is to use g_idle_add(). Call-backs added to it will be executed in priority order when there are no other tasks needed to be done. GTK does use the idle functions at a high priority to do its redraws, but a default priority should be OK for you.
gboolena my_delayed_function(gpointer user_data)
{
// The function that does the scroll goes here.
return FALSE;
}
void my_function_that_shows_something()
{
// Do some drawing.
// ...
// Schedule a scroll.
g_idle_add(my_delayed_function, NULL);
}
As a note you must return FALSE from that call-back otherwise it will be called repeatedly.
Upvotes: 1