X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=gtk%2Fgtk.main_loop_events.lisp;h=961b357f5334e11ea31a12778f79a042a7192cf3;hb=804b4c8f24b3725eb90f29d7e6910b2598b68771;hp=d2bdb9c23683f1707d19b4b90e61ec8db996450f;hpb=246031be275ccb404e6344461f516a874ba88341;p=cl-gtk2.git diff --git a/gtk/gtk.main_loop_events.lisp b/gtk/gtk.main_loop_events.lisp index d2bdb9c..961b357 100644 --- a/gtk/gtk.main_loop_events.lisp +++ b/gtk/gtk.main_loop_events.lisp @@ -17,13 +17,7 @@ (error "Cannot initialize Gtk+")) (foreign-free (mem-ref argv '(:pointer :string)))))) -(gtk-init) - -(defcfun gtk-test-register-all-types :void) - -(gtk-test-register-all-types) - -(defcfun gtk-events-pending :boolean) +(at-init () (gtk-init)) (defcfun gtk-main :void) @@ -31,15 +25,26 @@ (defvar *main-thread* nil) #+thread-support +(at-finalize () + (when (and *main-thread* (bt:thread-alive-p *main-thread*)) + (bt:destroy-thread *main-thread*) + (setf *main-thread* nil))) + +#+thread-support (defun ensure-gtk-main () + (when (and *main-thread* (not (bt:thread-alive-p *main-thread*))) + (setf *main-thread* nil)) (unless *main-thread* - (setf *main-thread* (bt:make-thread (lambda () (gtk:gtk-main)) :name "cl-gtk2 main thread")))) + (setf *main-thread* (bt:make-thread (lambda () (gtk-main)) :name "cl-gtk2 main thread")))) #+thread-support (defun join-main-thread () (when *main-thread* (bt:join-thread *main-thread*))) +#+thread-support +(export 'join-main-thread) + #-thread-support (defun ensure-gtk-main () (gtk-main))