X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=gtk%2Fgtk.main_loop_events.lisp;h=961b357f5334e11ea31a12778f79a042a7192cf3;hb=804b4c8f24b3725eb90f29d7e6910b2598b68771;hp=e1756da98092a484d5e1abc4b47b2cc84f052819;hpb=aafe7e856ef67b6e37478e16c766cd3c2c7f217b;p=cl-gtk2.git diff --git a/gtk/gtk.main_loop_events.lisp b/gtk/gtk.main_loop_events.lisp index e1756da..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,9 +25,17 @@ (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 ()