3 (defcfun (keymap-get-default "gdk_keymap_get_default") (g-object keymap
))
5 (export 'keymap-get-default
)
7 (defcfun (keymap-get-for-display "gdk_keymap_get_for_display") (g-object keymap
)
8 (display (g-object display
)))
10 (export 'keymap-get-for-display
)
12 (defcfun (keymap-lookup-key "gdk_keymap_lookup_key") :uint
13 (keymap (g-object keymap
))
14 (key (g-boxed-foreign keymap-key
)))
16 (export 'keymap-lookup-key
)
18 (defcfun gdk_keymap_translate_keyboard_state
:boolean
19 (keymap (g-object keymap
))
20 (hardware-keycode :uint
)
23 (keyval (:pointer
:uint
))
24 (effective-group (:pointer
:int
))
25 (level (:pointer
:int
))
26 (consumed-modifiers (:pointer modifier-type
)))
28 (defun keymap-translate-keyboard-state (keymap hardware-keycode state group
)
29 (with-foreign-objects ((keyval :uint
) (effective-group :int
) (level :int
) (modifiers 'modifier-type
))
30 (if (gdk_keymap_translate_keyboard_state keymap hardware-keycode state group keyval effective-group level modifiers
)
31 (values (mem-ref keyval
:uint
)
32 (mem-ref effective-group
:int
)
34 (mem-ref modifiers
'modifier-type
)))))
36 (export 'keymap-translate-keyboard-state
)
38 (defcfun gdk_keymap_get_entries_for_keyval
:boolean
39 (keymap (g-object keymap
))
41 (keys (:pointer
(:pointer keymap-key-cstruct
)))
42 (n-keys (:pointer
:int
)))
44 (defun keymap-get-entries-for-keyval (keymap keyval
)
45 (with-foreign-objects ((keys :pointer
) (n-keys :int
))
46 (when (gdk_keymap_get_entries_for_keyval keymap keyval keys n-keys
)
47 (let ((keys (mem-ref keys
:pointer
))
48 (n-keys (mem-ref n-keys
:int
)))
50 (iter (for i from
0 below n-keys
)
51 (for keymap-key
= (convert-from-foreign (inc-pointer keys
(* i
(foreign-type-size 'keymap-key-cstruct
)))
52 '(g-boxed-foreign keymap-key
)))
54 (glib:g-free keys
))))))
56 (export 'keymap-get-entries-for-keyval
)
58 (defcfun gdk_keymap_get_entries_for_keycode
:boolean
59 (keymap (g-object keymap
))
60 (hardware-keycode :uint
)
61 (keys (:pointer
(:pointer keymap-key-cstruct
)))
62 (keyvals (:pointer
(:pointer
:uint
)))
63 (n-entries (:pointer
:int
)))
65 (defun keymap-get-entries-for-keymap (keymap hardware-keycode
)
66 (with-foreign-objects ((keys :pointer
) (keyvals :pointer
) (n-keys :int
))
67 (when (gdk_keymap_get_entries_for_keycode keymap hardware-keycode keys keyvals n-keys
)
68 (let ((keys (mem-ref keys
:pointer
))
69 (keyvals (mem-ref keyvals
:pointer
))
70 (n-keys (mem-ref n-keys
:int
)))
72 (iter (for i from
0 below n-keys
)
73 (for keyval
= (mem-aref keyvals
:uint
))
74 (for keymap-key
= (convert-from-foreign (inc-pointer keys
(* i
(foreign-type-size 'keymap-key-cstruct
)))
75 '(g-boxed-foreign keymap-key
)))
76 (collect keymap-key into r-keys
)
77 (collect keyval into r-keyvals
)
78 (finally (return (values r-keys r-keyvals
))))
80 (glib:g-free keyvals
))))))
82 (export 'keymap-get-entries-for-keymap
)
84 (defcfun (keyval-name "gdk_keyval_name") (:string
:free-from-foreign nil
)
89 (defcfun (keyval-from-name "gdk_keyval_from_name") :uint
90 (keyval-name :string
))
92 (export 'keyval-from-name
)
94 (defcfun (keyval-to-upper "gdk_keyval_to_upper") :uint
97 (export 'keyval-to-upper
)
99 (defcfun (keyval-to-lower "gdk_keyval_to_lower") :uint
102 (export 'keyval-to-lower
)
104 (defcfun (keyval-is-upper "gdk_keyval_is_upper") :boolean
107 (export 'keyval-is-upper
)
109 (defcfun (keyval-is-lower "gdk_keyval_is_lower") :boolean
113 ;; void gdk_keyval_convert_case (guint symbol,
117 (define-foreign-type unichar
()
119 (:actual-type
:uint32
)
120 (:simple-parser unichar
))
122 (defmethod translate-from-foreign (value (type unichar
))
125 (defmethod translate-to-foreign (value (type unichar
))
128 (defcfun (keyval-to-char "gdk_keyval_to_unicode") unichar
131 (export 'keyval-to-char
)
133 (defcfun (char-to-keyval "gdk_unicode_to_keyval") :uint
136 (export 'char-to-keyval
)