using gtk in non-gtk apps



Hello all,

We are transitioning to a platform-independent UI (i.e. using gtk).  So
far, we only want to use gtk in new widgets (such as new dialogs) and
not change the main applications yet.  But I am having problems
integrating my first dialog using GtkDialog.

On linux (using motif), I have gotten everything to compile, run, and
even pop up the gtk dialog with almost full functionality.  The problem
is when coming back from gtk_dialog_run() (clicking OK or CANCEL), the
_display_ of the widget stops responding.  It doesn't close, hide, or
destroy as it should, but just stays up floating around while the main
application goes on fine.

{
m_gtk_parent = NULL; // NULL because parent window isn't a gtk window
m_gtk_dialog = gtk_dialog_new_with_buttons( "Testing Dialog:",
                                             m_gtk_parent, 
 
GTK_DIALOG_DESTROY_WITH_PARENT, // no flag combination works
                                             GTK_STOCK_OK,
GTK_RESPONSE_OK,
                                             GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
                                             NULL);

gint response = gtk_dialog_run (GTK_DIALOG (m_gtk_dialog));  // waits
for user to close
gtk_widget_hide_all (m_gtk_dialog);
if (response == GTK_RESPONSE_OK) { /* handle response */ }
gtk_widget_destroy(m_gtk_dialog);
}

I don't call gtk_main() anywhere, so there's no gtk_main_quit().

The prior code doesn't hide or destroy the dialog.  The client section
of the dialog stops responding (makes sense).  But clicking on top-right
corner close (on the window's decoration) eventually responds with "The
window "Testing Dialog:" is not responding".  

I haven't seen any documentation or discussion in whether gtk can work
with non-gtk widgets/windows in same application.  Is this possible?

Thanks!
-Trevor




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