Package: gtk

Function gtk-main

Lambda List

gtk-main ()

Details

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

Lisp Implementation

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

Example

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

(defun main () ;; Add an idle source to the main loop. (g-idle-add #'main-idle-cb) ;; Start the main loop. ;; We return when gtk-main-quit is called in the idle callback. (gtk-main))
 

See also

2020-8-22