Permalink
Browse files

Use g_thread_get_initialized instead of C-wrapped macro.

  • Loading branch information...
1 parent 8fb8d17 commit cf02ca523ce6f36a2df8ae2867b2dd1a8d8b95f7 @Ramarren committed Dec 8, 2010
Showing with 18 additions and 24 deletions.
  1. +17 −23 cells-gtk/gtk-app.lisp
  2. +1 −0 gtk-ffi/gtk-core.lisp
  3. +0 −1 gtk-ffi/gtk-other.lisp
View
@@ -135,9 +135,6 @@
;;; Initialize GDK
-;;; When we have libcellsgtk, we can use a glib function to check whether
-;;; is initialized. Otherwise we need a variable
-
(defvar *gtk-loaded* #+clisp t #-clisp nil) ;; kt: looks like CLisp does this on its own
(defun cells-gtk-init ()
@@ -148,26 +145,23 @@
(setf *gtk-loaded* t))
(gtk-reset))
-(let (#-libcellsgtk (threading-initialized nil))
- (defun init-gtk (&key close-all-windows)
- "Replacement for cells-gtk-init. Threadsafe. Use to reset cells-gtk to a defined state."
- (unless *gtk-loaded* ; make sure gtk is loaded
- (gtk-ffi:load-gtk-libs)
- (setf *gtk-loaded* t))
- (when close-all-windows
- (gtk-main-quit))
- (when #+libcellsgtk (= 0 (gtk-adds-g-thread-supported)) ; init only once
- #-libcellsgtk (not threading-initialized)
- (with-trcs
- #+cells-gtk-threads
- (progn
- (g-thread-init +c-null+) ; init threading
- (gdk-threads-init))
- (assert (gtk-init-check +c-null+ +c-null+))
- (gtk-init +c-null+ +c-null+)
- #+cells-gtk-opengl (gl-init)
- (gtk-reset)
- #-libcellsgtk (setf threading-initialized t)))))
+(defun init-gtk (&key close-all-windows)
+ "Replacement for cells-gtk-init. Threadsafe. Use to reset cells-gtk to a defined state."
+ (unless *gtk-loaded* ; make sure gtk is loaded
+ (gtk-ffi:load-gtk-libs)
+ (setf *gtk-loaded* t))
+ (when close-all-windows
+ (gtk-main-quit))
+ (unless (g-thread-get-initialized) ; init only once
+ (with-trcs
+ #+cells-gtk-threads
+ (progn
+ (g-thread-init +c-null+) ; init threading
+ (gdk-threads-init))
+ (assert (gtk-init-check +c-null+ +c-null+))
+ (gtk-init +c-null+ +c-null+)
+ #+cells-gtk-opengl (gl-init)
+ (gtk-reset))))
;;; Instantiate and show app (show splash)
View
@@ -41,6 +41,7 @@
(gerror :pointer))))
(def-gtk-lib-functions :gthread
+ (g-thread-get-initialized gboolean nil)
(g-thread-init :void ((vtable :pointer))))
(def-gtk-lib-functions :gdk
View
@@ -885,7 +885,6 @@
(green :unsigned-int)
(blue :unsigned-int)))
(gtk-adds-ok :int ())
- (gtk-adds-g-thread-supported :int ())
(gtk-adds-widget-width :int ((widget :pointer)))
(gtk-adds-widget-height :int ((widget :pointer))))

0 comments on commit cf02ca5

Please sign in to comment.