(event (g-boxed-foreign event)))
(export 'display-put-event)
-;void gdk_display_add_client_message_filter
-; (GdkDisplay *display,
-; GdkAtom message_type,
-; GdkFilterFunc func,
-; gpointer data);
+(defcfun gdk_display_add_client_message_filter :void
+ (display (g-object display))
+ (message-type gdk-atom-as-string)
+ (func :pointer)
+ (data :pointer))
+
+(defun dispaly-add-client-message-filter (display message-type fn)
+ (gdk_display_add_client_message_filter display message-type (callback gdk-client-message-filter-func) (allocate-stable-pointer fn)))
+
+(export 'display-add-client-message-filter)
(defcfun (display-set-double-click-time "gdk_display_set_double_click_time") :void
(display (g-object display))
(export 'display-get-window-at-pointer)
+; ignored:
;GdkDisplayPointerHooks * gdk_display_set_pointer_hooks (GdkDisplay *display,
; const GdkDisplayPointerHooks *new_hooks);
(gdk-spawn-command-line-on-screen screen command-line err)))
(export 'spawn-command-line-on-screen)
+
+(defcfun gdk_spawn_on_screen :boolean
+ (screen (g-object screen))
+ (working-directory :string)
+ (argv :pointer)
+ (envp :pointer)
+ (flags glib:g-spawn-flags)
+ (child-setup :pointer)
+ (user-data :pointer)
+ (child-pid (:pointer :int))
+ (g-error :pointer))
+
+(defcfun gdk_spawn_on_screen_with_pipes :boolean
+ (screen (g-object screen))
+ (working-directory :string)
+ (argv :pointer)
+ (envp :pointer)
+ (flags glib:g-spawn-flags)
+ (child-setup :pointer)
+ (user-data :pointer)
+ (child-pid (:pointer :int))
+ (std-input (:pointer :int))
+ (std-output (:pointer :int))
+ (std-err (:pointer :int))
+ (g-error :pointer))
+
+(defmacro with-foreign-string-array ((var strings &key (null-terminated t)) &body body)
+ (let ((strings-var (gensym))
+ (s (gensym))
+ (i (gensym))
+ (n (gensym)))
+ `(let* ((,strings-var ,strings)
+ (,n (length ,strings-var)))
+ (with-foreign-object (,var :pointer ,(if null-terminated `(1+ ,n) `,n))
+ (iter (for ,s in ,strings-var)
+ (for ,i from 0)
+ (setf (mem-aref ,var :pointer ,i) (foreign-string-alloc ,s))
+ ,@(when null-terminated
+ (list `(finally (setf (mem-aref ,var :pointer ,n) (null-pointer))))))
+ (unwind-protect (progn ,@body)
+ (iter (for ,i from 0 below ,n)
+ (foreign-string-free (mem-aref ,var :pointer ,i))))))))
+
+(defun gdk-spawn-on-screen (screen argv &key working-directory env (flags '(:search-path)) with-pipes)
+ (unless working-directory (setf working-directory (null-pointer)))
+ (glib:with-g-error (err)
+ (with-foreign-objects ((pid :int) (stdin :int) (stdout :int) (stderr :int))
+ (with-foreign-string-array (argvp argv)
+ (if (null env)
+ (if with-pipes
+ (gdk_spawn_on_screen_with_pipes screen
+ working-directory
+ argvp
+ (null-pointer)
+ flags
+ (null-pointer)
+ (null-pointer)
+ pid stdin stdout stderr err)
+ (gdk_spawn_on_screen screen
+ working-directory
+ argvp
+ (null-pointer)
+ flags
+ (null-pointer)
+ (null-pointer)
+ pid err))
+ (with-foreign-string-array (envp env)
+ (if with-pipes
+ (gdk_spawn_on_screen_with_pipes screen
+ working-directory
+ argvp envp flags
+ (null-pointer) (null-pointer)
+ pid stdin stdout stderr err)
+ (gdk_spawn_on_screen screen
+ working-directory
+ argvp envp
+ flags (null-pointer) (null-pointer)
+ pid err)))))
+ (if with-pipes
+ (values (mem-ref pid :int) (mem-ref stdin :int) (mem-ref stdout :int) (mem-ref stderr :int))
+ (mem-ref pid :int)))))
+
+(export 'gdk-spawn-on-screen)
#:g-error-condition
#:g-error-condition-domain
#:g-error-condition-code
- #:g-error-condition-message)
+ #:g-error-condition-message
+ #:g-spawn-flags)
(:documentation
"Cl-gtk2-glib is wrapper for @a[http://library.gnome.org/devel/glib/]{GLib}."))
(str (:string :free-to-foreign t)))
;omitted all GLib Utilites
-;TODO: omitted Date and Time Functions
+(defbitfield g-spawn-flags
+ :leave-descriptors-open :do-not-reap-child :search-path :stdout-to-dev-null :stderr-to-dev-null
+ :child-inherits-stdin :file-and-argv-zero)
+
+;TODO: omitted Date and Time Functions