如何使用 Commpn Lisp CFFI 关闭 Gtk4 应用程序的所有窗口?

问题描述 投票:0回答:0

关闭 Gtk4 库的方法似乎是关闭所有窗口。基于 gir 的绑定只允许关闭单个窗口。

https://docs.gtk.org/glib/type_func.List.foreach.html 似乎是要走的路。

我想将应用程序窗口列表传递给它并调用窗口关闭函数。 请批评我非常幼稚的尝试。 假设我的 gtk4 函数是正确的,我该如何在 cffi 中执行以下操作?

 (cffi:define-foreign-library libglib)
 (cffi:use-foreign-library libglib)
 (cffi:defcfun "g_list_foreach" :void
   (list :pointer)
   (func :pointer)
   (user-data :pointer))
 (cffi:foreign-funcall "g_list_foreach"
                       :pointer (gtk4:application-windows app)
                       :pointer #'gtk4:window-close
                       :pointer nil)                                              

我使用 https://github.com/bohonghuang/cl-gtk4 构建了我的应用程序,并将 glib 绑定添加到我的 fork。然而,git introspection 没有提供做我需要的方法。

common-lisp gtk4 cffi
© www.soinside.com 2019 - 2024. All rights reserved.