Mercurial > dwindows
diff gtk/dw.c @ 41:af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
name in applications, as well as some GTK updates for using dialogs
before calling dw_main().
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 23 Oct 2001 18:37:46 +0000 |
parents | 88c9c7410c22 |
children | 30d091bc7899 |
line wrap: on
line diff
--- a/gtk/dw.c Mon Oct 22 22:32:58 2001 +0000 +++ b/gtk/dw.c Tue Oct 23 18:37:46 2001 +0000 @@ -607,7 +607,7 @@ int dw_dialog_dismiss(DWDialog *dialog, void *result) { dialog->result = result; - if(pthread_self() == _dw_thread) + if(pthread_self() == _dw_thread || _dw_thread == (pthread_t)-1) gtk_main_quit(); else dw_event_post(dialog->eve); @@ -624,12 +624,27 @@ void *dw_dialog_wait(DWDialog *dialog) { void *tmp; + int newprocess = 0; + + /* _dw_thread will be -1 if dw_main hasn't been run yet. */ + if(_dw_thread == (pthread_t)-1) + { + _dw_thread = pthread_self(); + newprocess = 1; + gdk_threads_enter(); + } if(pthread_self() == _dw_thread) gtk_main(); else dw_event_wait(dialog->eve, -1); + if(newprocess) + { + _dw_thread = (pthread_t)-1; + gdk_threads_leave(); + } + dw_event_close(&dialog->eve); tmp = dialog->result; free(dialog);