3 (defcallback stable-pointer-free-destroy-notify-callback
:void
((data :pointer
))
4 (free-stable-pointer data
))
6 (defcfun (get-clipboard "gtk_clipboard_get") g-object
7 (selection gdk-atom-as-string
))
9 (export 'get-clipboard
)
11 (defcallback call-from-main-loop-callback
:boolean
14 (progn (funcall (get-stable-pointer-value data
))
16 (return-from-callback () nil
)))
18 (defun call-from-gtk-main-loop (function &key
(priority +g-priority-default-idle
+))
19 (g-idle-add-full priority
20 (callback call-from-main-loop-callback
)
21 (allocate-stable-pointer function
)
22 (callback stable-pointer-free-destroy-notify-callback
))
25 (export 'call-from-gtk-main-loop
)
27 (defcallback call-timeout-from-main-loop-callback
:boolean
30 (progn (funcall (get-stable-pointer-value data
)))
31 (return-from-callback () nil
)))
33 (defun gtk-main-add-timeout (milliseconds function
&key
(priority +g-priority-default
+))
34 (g-timeout-add-full priority milliseconds
35 (callback call-timeout-from-main-loop-callback
)
36 (allocate-stable-pointer function
)
37 (callback stable-pointer-free-destroy-notify-callback
)))
39 (export 'gtk-main-add-timeout
)
41 (defmacro within-main-loop
(&body body
)
42 `(call-from-gtk-main-loop (lambda () ,@body
)))
44 (export 'within-main-loop
)
47 (defmacro with-main-loop
(&body body
)
50 (within-main-loop ,@body
)))
53 (defmacro with-main-loop
(&body body
)
58 (export 'with-main-loop
)