Add gdk-add-client-message-filter
authorDmitry Kalyanov <Kalyanov.Dmitry@gmail.com>
Fri, 20 Nov 2009 21:27:15 +0000 (00:27 +0300)
committerDmitry Kalyanov <Kalyanov.Dmitry@gmail.com>
Fri, 20 Nov 2009 21:27:15 +0000 (00:27 +0300)
gdk/gdk.events.lisp

index 8fd27f6..d3d2b6a 100644 (file)
 
 (export 'event-send-client-message-to-all)
 
-;; void                gdk_add_client_message_filter       (GdkAtom message_type,
-;;                                                          GdkFilterFunc func,
-;;                                                          gpointer data);
+(defcallback gdk-client-message-filter-func gdk-filter-return
+    ((xevent :pointer) (event :pointer) (data :pointer))
+  (multiple-value-bind (return-value translated-event) (funcall (stable-pointer-value data) xevent)
+    (when (eq return-value :translate)
+      (gobject:copy-boxed-slots-to-foreign translated-event event))
+    return-value))
+
+(defcfun gdk_add_client_message_filter :void
+  (message-type gdk-atom-as-string)
+  (func :pointer)
+  (data :pointer))
+
+(defun gdk-add-client-message-filter (message-type fn)
+  (gdk_add_client_message_filter message-type (callback gdk-client-message-filter-func) (allocate-stable-pointer fn)))
+
+(export 'gdk-add-client-message-filter)
 
 (defcfun gdk-get-show-events :boolean)