[gtk-cffi-cvs] CVS gtk-cffi/gdk

CVS User rklochkov rklochkov at common-lisp.net
Wed Sep 21 12:03:47 UTC 2011


Update of /project/gtk-cffi/cvsroot/gtk-cffi/gdk
In directory tiger.common-lisp.net:/tmp/cvs-serv6570/gdk

Modified Files:
	keys.lisp package.lisp 
Log Message:
Several fixes for struct memory management.
Now we can use cffi-object:struct lisp values in place for cffi-object:pobject
when we don't rerturn value. When you need to fill pointer slot for struct,
just describe it as (object smth) in defcfun



--- /project/gtk-cffi/cvsroot/gtk-cffi/gdk/keys.lisp	2011/09/15 10:28:20	1.5
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gdk/keys.lisp	2011/09/21 12:03:47	1.6
@@ -2,11 +2,23 @@
 
 (defcfun (keyval-from-name "gdk_keyval_from_name") :uint (val :string))
 (defcfun (keyval-name "gdk_keyval_name") :string (val :uint))
-(defcfun (keyval-to-unicode "gdk_keyval_to_unicode") :uint32 (val :uint))
-(defcfun (unicode-to-keyval "gdk_unicode_to_keyval") :uint (val :uint32))
 (defcfun (keyval-to-upper "gdk_keyval_to_upper") :uint (val :uint))
 (defcfun (keyval-to-lower "gdk_keyval_to_lower") :uint (val :uint))
 
+(define-foreign-type unichar ()
+  ()
+  (:actual-type :uint32)
+  (:simple-parser unichar))
+
+(defmethod translate-to-foreign (value (unichar unichar))
+  (char-code value))
+
+(defmethod translate-from-foreign (value (unichar unichar))
+  (code-char value))
+
+(defcfun (keyval-to-unicode "gdk_keyval_to_unicode") unichar (val :uint))
+(defcfun (unicode-to-keyval "gdk_unicode_to_keyval") :uint (val unichar))
+
 (defun key (value)
   (keyval-from-name (string value)))
 
--- /project/gtk-cffi/cvsroot/gtk-cffi/gdk/package.lisp	2011/09/15 10:28:20	1.5
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gdk/package.lisp	2011/09/21 12:03:47	1.6
@@ -48,6 +48,7 @@
    #:with-threads
 
    #:key
+   #:unichar
    
    #:keymap
    #:keycode





More information about the gtk-cffi-cvs mailing list