Package: gtk

Function gtk:main

Lambda List

gtk:main ()

Details

Runs the main loop until the gtk:main-quit function is called. You can nest calls to the gtk:main function. In that case the gtk:main-quit function will make the innermost invocation of the main loop return.

Lisp Implementation

In the Lisp binding to GTK the gtk:main function is not called directly but through the gtk:within-main-loop macro. The gtk:within-main-loop macro does some additional bookkeeping, to run the Lisp program in a separate thread.

Examples

In this example an idle source is excecuted from the main loop. The gtk:main-quit function is called in the idle callback to quit the main loop.
(defun idle-cb ()
  (format t "~&Execute IDLE-CB level ~a~%" (gtk:main-level))
  ;; Quit the main loop
  (gtk:main-quit)
  ;; Remove the idle source
  glib:+source-remove+)

(defun main () ;; Add an idle source to the main loop (g:idle-add #'idle-cb) ;; Start the main loop ;; Returns when GTK:MAIN-QUIT is called in the idle callback (gtk:main))
 

See also

2024-6-29