Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
40:88c9c7410c22 | 41:af0a78aa0d45 |
---|---|
605 * result: Data to be returned by dw_dialog_wait(). | 605 * result: Data to be returned by dw_dialog_wait(). |
606 */ | 606 */ |
607 int dw_dialog_dismiss(DWDialog *dialog, void *result) | 607 int dw_dialog_dismiss(DWDialog *dialog, void *result) |
608 { | 608 { |
609 dialog->result = result; | 609 dialog->result = result; |
610 if(pthread_self() == _dw_thread) | 610 if(pthread_self() == _dw_thread || _dw_thread == (pthread_t)-1) |
611 gtk_main_quit(); | 611 gtk_main_quit(); |
612 else | 612 else |
613 dw_event_post(dialog->eve); | 613 dw_event_post(dialog->eve); |
614 dialog->done = TRUE; | 614 dialog->done = TRUE; |
615 return 0; | 615 return 0; |
622 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | 622 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). |
623 */ | 623 */ |
624 void *dw_dialog_wait(DWDialog *dialog) | 624 void *dw_dialog_wait(DWDialog *dialog) |
625 { | 625 { |
626 void *tmp; | 626 void *tmp; |
627 int newprocess = 0; | |
628 | |
629 /* _dw_thread will be -1 if dw_main hasn't been run yet. */ | |
630 if(_dw_thread == (pthread_t)-1) | |
631 { | |
632 _dw_thread = pthread_self(); | |
633 newprocess = 1; | |
634 gdk_threads_enter(); | |
635 } | |
627 | 636 |
628 if(pthread_self() == _dw_thread) | 637 if(pthread_self() == _dw_thread) |
629 gtk_main(); | 638 gtk_main(); |
630 else | 639 else |
631 dw_event_wait(dialog->eve, -1); | 640 dw_event_wait(dialog->eve, -1); |
641 | |
642 if(newprocess) | |
643 { | |
644 _dw_thread = (pthread_t)-1; | |
645 gdk_threads_leave(); | |
646 } | |
632 | 647 |
633 dw_event_close(&dialog->eve); | 648 dw_event_close(&dialog->eve); |
634 tmp = dialog->result; | 649 tmp = dialog->result; |
635 free(dialog); | 650 free(dialog); |
636 return tmp; | 651 return tmp; |