3 (defcfun gtk-init-check
:boolean
5 (argv (:pointer
(:pointer
:string
))))
8 (gtk-init-check (foreign-alloc :int
:initial-element
0)
9 (foreign-alloc :string
:initial-contents
'("/usr/bin/sbcl")))
10 #+nil
(with-foreign-objects ((argc :int
)
11 (argv '(:pointer
:string
) 1))
12 (setf (mem-ref argc
:int
) 0
13 (mem-ref argv
'(:pointer
:string
)) (foreign-alloc :string
:count
1
14 :initial-element
"/usr/bin/sbcl"))
16 (unless (gtk-init-check argc argv
)
17 (error "Cannot initialize Gtk+"))
18 (foreign-free (mem-ref argv
'(:pointer
:string
))))))
20 (at-init () (gtk-init))
22 (defcfun gtk-main
:void
)
25 (defvar *main-thread
* nil
)
29 (when (and *main-thread
* (bt:thread-alive-p
*main-thread
*))
30 (bt:destroy-thread
*main-thread
*)
31 (setf *main-thread
* nil
)))
34 (defun ensure-gtk-main ()
35 (when (and *main-thread
* (not (bt:thread-alive-p
*main-thread
*)))
36 (setf *main-thread
* nil
))
38 (setf *main-thread
* (bt:make-thread
(lambda () (gtk-main)) :name
"cl-gtk2 main thread"))))
41 (defun join-main-thread ()
43 (bt:join-thread
*main-thread
*)))
46 (export 'join-main-thread
)
49 (defun ensure-gtk-main ()
52 (export 'ensure-gtk-main
)
55 (defun leave-gtk-main ()) ;noop on multithreading
58 (defun leave-gtk-main ()
61 (export 'leave-gtk-main
)
63 (defcfun gtk-main-level
:uint
)
65 (defcfun gtk-main-quit
:void
)
67 (defcfun gtk-grab-add
:void
70 (defcfun gtk-grab-get-current g-object
)
72 (defcfun gtk-grab-remove
:void