I have two GTK windows
Normal (main) window that runs animation, draws stuff in callback registered by
gtk_widget_add_tick_callback()
.At some point secondary window is created that runs modal loop:
void show_modal() { GtkWindow* gw = gtkwindow(this); if( parent() ) gtk_window_set_transient_for(gw, gtkwindow( parent() )); gtk_widget_show(GTK_WIDGET(gw)); gtk_window_set_modal(gw,TRUE); gtk_window_set_keep_above(gw,TRUE); this->update_window_state(gool::WINDOW_SHOWN); while( this->is_valid_window() ) { if(this->_window_state == WINDOW_HIDDEN) break; if(this->_window_state == WINDOW_STATE_NA) break; gtk_main_iteration(); // gtk_main_iteration_do(true); } }
Problem: Animation in main window works fine until show_modal()
is invoked. It appears as gtk_main_iteration();
blocks ticks added by gtk_widget_add_tick_callback()
function. As soon as I close secondary window and so while() {gtk_main_iteration();}
loop exits then animations in main window start running again.
Any idea of how to make "animation friendly" modal loops in GTK?
UPDATE: it appears as gtk_main_iteration();
blocks not only ticks but any updates of any windows other than "current" - they are simply frozen. What is the reasoning of such GTK behavior?
UPDATE #2:
gtk_dialog_run();
behaves exactly as gtk_main_iteration();
- locks any updates on any window in process other than active window.