diff options
Diffstat (limited to 'lib/xlib.sls')
-rw-r--r-- | lib/xlib.sls | 607 |
1 files changed, 607 insertions, 0 deletions
diff --git a/lib/xlib.sls b/lib/xlib.sls new file mode 100644 index 0000000..a1915c5 --- /dev/null +++ b/lib/xlib.sls | |||
@@ -0,0 +1,607 @@ | |||
1 | ;;; (acdw xlib) --- xlib wrapper ... wrapper | ||
2 | ;; Rationale: the xlib egg is by its own admission pretty raw. this library | ||
3 | ;; tries to cook it a little. | ||
4 | |||
5 | (import xlib | ||
6 | (chicken bitwise) | ||
7 | (acdwm util)) | ||
8 | (import-for-syntax (acdwm util)) | ||
9 | |||
10 | (define *xdisplay | ||
11 | (make-parameter | ||
12 | (delay (xopendisplay #f)))) | ||
13 | |||
14 | (define-public (get-display) | ||
15 | (force (*xdisplay))) | ||
16 | |||
17 | (define-public (get-screen #!optional (dpy (get-display))) | ||
18 | (xdefaultscreen dpy)) | ||
19 | |||
20 | (define-public (get-root #!optional (dpy (get-display)) scrn) | ||
21 | (dprint "getting root") | ||
22 | (xrootwindow dpy (or scrn (get-screen dpy)))) | ||
23 | |||
24 | ;;; Constants | ||
25 | |||
26 | (define-public TRUE 1) | ||
27 | (define-public FALSE 0) | ||
28 | |||
29 | ;;; Working with X structures | ||
30 | ;; These functions wrap C functions with 'return pointers' | ||
31 | |||
32 | (define-public (get-next-event #!optional (dpy (get-display))) | ||
33 | (let ((event (make-xevent))) | ||
34 | (xnextevent dpy event) | ||
35 | (dprint "get-next-event: " (xevent-type-name (xevent-type event))) | ||
36 | event)) | ||
37 | |||
38 | (define-public (get-next-masked-event mask #!optional (dpy (get-display))) | ||
39 | (let ((event (make-xevent))) | ||
40 | (xmaskevent dpy mask event) | ||
41 | event)) | ||
42 | |||
43 | (define-public (get-window-attributes win #!optional (dpy (get-display))) | ||
44 | (let ((attrs (make-xwindowattributes))) | ||
45 | (xgetwindowattributes dpy win attrs) | ||
46 | attrs)) | ||
47 | |||
48 | ;; And these wrap C functions to make sure resources are freed | ||
49 | |||
50 | (define-public (call-with-modifier-keymap proc #!optional (dpy (get-display))) | ||
51 | (let ((modmap (make-xmodifierkeymap))) | ||
52 | (dynamic-wind (lambda () (set! modmap (xgetmodifiermapping dpy))) | ||
53 | (lambda () (proc modmap)) | ||
54 | (lambda () (free-xmodifierkeymap modmap))))) | ||
55 | |||
56 | ;;; Predicates | ||
57 | |||
58 | (define-public (none? x) ; this could be zero? ... but maybe | ||
59 | (= NONE x)) ; it'll change! | ||
60 | |||
61 | (define-public some? ; neologism | ||
62 | (complement none?)) | ||
63 | |||
64 | ;; Events | ||
65 | (define-syntax define-event-predicate | ||
66 | (syntax-rules () | ||
67 | ((define-event-predicate predicate event) | ||
68 | (define-public (predicate ev*) | ||
69 | (= event (xevent-type ev*)))))) | ||
70 | |||
71 | (define-event-predicate buttonpress? BUTTONPRESS) | ||
72 | (define-event-predicate buttonrelease? BUTTONRELEASE) | ||
73 | (define-event-predicate circulatenotify? CIRCULATENOTIFY) | ||
74 | (define-event-predicate clientmessage? CLIENTMESSAGE) | ||
75 | (define-event-predicate colormapnotify? COLORMAPNOTIFY) | ||
76 | (define-event-predicate createnotify? CREATENOTIFY) | ||
77 | (define-event-predicate destroynotify? DESTROYNOTIFY) | ||
78 | (define-event-predicate enternotify? ENTERNOTIFY) | ||
79 | (define-event-predicate expose? EXPOSE) | ||
80 | (define-event-predicate focuschangemask? FOCUSCHANGEMASK) | ||
81 | (define-event-predicate graphicsexpose? GRAPHICSEXPOSE) | ||
82 | (define-event-predicate gravitynotify? GRAVITYNOTIFY) | ||
83 | (define-event-predicate keypress? KEYPRESS) | ||
84 | (define-event-predicate keyrelease? KEYRELEASE) | ||
85 | (define-event-predicate keymapnotify? KEYMAPNOTIFY) | ||
86 | (define-event-predicate leavenotify? LEAVENOTIFY) | ||
87 | (define-event-predicate mapnotify? MAPNOTIFY) | ||
88 | (define-event-predicate maprequest? MAPREQUEST) | ||
89 | (define-event-predicate mappingnotify? MAPPINGNOTIFY) | ||
90 | (define-event-predicate motionnotify? MOTIONNOTIFY) | ||
91 | (define-event-predicate propertynotify? PROPERTYNOTIFY) | ||
92 | (define-event-predicate reparentnotify? REPARENTNOTIFY) | ||
93 | (define-event-predicate resizerequest? RESIZEREQUEST) | ||
94 | (define-event-predicate selectionclear? SELECTIONCLEAR) | ||
95 | (define-event-predicate selectionnotify? SELECTIONNOTIFY) | ||
96 | (define-event-predicate selectionrequest? SELECTIONREQUEST) | ||
97 | (define-event-predicate substructureredirectmask? SUBSTRUCTUREREDIRECTMASK) | ||
98 | (define-event-predicate unmapnotify? UNMAPNOTIFY) | ||
99 | (define-event-predicate visibilitynotify? VISIBILITYNOTIFY) | ||
100 | ;; (define-event-predicate xconfigureevent? XCONFIGUREEVENT) | ||
101 | ;; (define-event-predicate xconfigurerequestevent? XCONFIGUREREQUESTEVENT) | ||
102 | ;; (define-event-predicate xdestroywindowevent? XDESTROYWINDOWEVENT) | ||
103 | ;; (define-event-predicate xfocusoutevent? XFOCUSOUTEVENT) | ||
104 | ;; (define-event-predicate xgravityevent? XGRAVITYEVENT) | ||
105 | ;; (define-event-predicate xmapevent? XMAPEVENT) | ||
106 | ;; (define-event-predicate xnoexposeevent? XNOEXPOSEEVENT) | ||
107 | ;; (define-event-predicate xreparentevent? XREPARENTEVENT) | ||
108 | ;; (define-event-predicate xunmapevent? XUNMAPEVENT) | ||
109 | |||
110 | ;;; Deconstructing the XEvent union type | ||
111 | |||
112 | (define-syntax define-xevent->subevent | ||
113 | (er-macro-transformer | ||
114 | (lambda (x r c) | ||
115 | (define (string-append->symbol . ss) | ||
116 | (string->symbol (apply string-append ss))) | ||
117 | ;; (define-xevent->subevent name . props) | ||
118 | (let* ((name (symbol->string (cadr x))) | ||
119 | (evname (string-append name "event")) | ||
120 | (fnname (string-append->symbol "xevent->" name "event"))) | ||
121 | `(,(r 'define-public) (,fnname ,(r 'xev)) | ||
122 | (dprint ',fnname) | ||
123 | (,(r 'let) ((,(r 'out) (,(string-append->symbol "make-" evname)))) | ||
124 | ,@(map (lambda (p) | ||
125 | ;; set-<evname>-<prop>! out (xevent-<name>-prop xev) | ||
126 | (let* ((pname (symbol->string p)) | ||
127 | (form | ||
128 | `(,(string-append->symbol "set-" evname "-" pname "!") | ||
129 | ,(r 'out) | ||
130 | (,(string-append->symbol "xevent-" name "-" pname) | ||
131 | ,(r 'xev))))) | ||
132 | `(begin (dprint ',form) | ||
133 | ,form))) | ||
134 | (cddr x)) | ||
135 | (,(r 'free-xevent) ,(r 'xev)) | ||
136 | ,(r 'out))))))) | ||
137 | |||
138 | |||
139 | (define-xevent->subevent xany | ||
140 | type display send_event serial type window) | ||
141 | (define-xevent->subevent xkey | ||
142 | type serial send_event display window root subwindow time | ||
143 | x y x_root y_root state keycode same_screen) | ||
144 | (define-xevent->subevent xbutton | ||
145 | type serial send_event display window root subwindow time | ||
146 | x y x_root y_root state button same_screen) | ||
147 | (define-xevent->subevent xmotion | ||
148 | type serial send_event display window root subwindow time | ||
149 | x y x_root y_root state is_hint same_screen) | ||
150 | (define-xevent->subevent xcrossing | ||
151 | type serial send_event display window root subwindow time | ||
152 | x y x_root y_root mode detail same_screen focus state) | ||
153 | (define-xevent->subevent xexpose | ||
154 | type serial send_event display window x y width height count) | ||
155 | (define-xevent->subevent xgraphicsexpose | ||
156 | type serial send_event display drawable x y width height | ||
157 | count major_code minor_code) | ||
158 | (define-xevent->subevent xnoexpose | ||
159 | type serial send_event display drawable major_code minor_code) | ||
160 | (define-xevent->subevent xvisibility | ||
161 | type serial send_event display window state) | ||
162 | (define-xevent->subevent xcreatewindow | ||
163 | type serial send_event display parent window | ||
164 | x y width height border_width override_redirect) | ||
165 | (define-xevent->subevent xdestroywindow | ||
166 | type serial send_event display event window) | ||
167 | (define-xevent->subevent xunmap | ||
168 | type serial send_event display event window from_configure) | ||
169 | (define-xevent->subevent xmap | ||
170 | type serial send_event display event window override_redirect) | ||
171 | (define-xevent->subevent xmaprequest | ||
172 | type serial send_event display parent window) | ||
173 | (define-xevent->subevent xreparent | ||
174 | type serial send_event display event window parent override_redirect) | ||
175 | (define-xevent->subevent xconfigure | ||
176 | type serial send_event display event window | ||
177 | x y width height border_width above override_redirect) | ||
178 | (define-xevent->subevent xgravity | ||
179 | type serial send_event display event window x y) | ||
180 | (define-xevent->subevent xresizerequest | ||
181 | type serial send_event display window width height) | ||
182 | (define-xevent->subevent xconfigurerequest | ||
183 | type serial send_event display parent window | ||
184 | x y width height border_width above detail value_mask) | ||
185 | (define-xevent->subevent xcirculate | ||
186 | type serial send_event display event window place) | ||
187 | (define-xevent->subevent xcirculaterequest | ||
188 | type serial send_event display parent window place) | ||
189 | (define-xevent->subevent xproperty | ||
190 | type serial send_event display window atom time state) | ||
191 | (define-xevent->subevent xselectionclear | ||
192 | type serial send_event display window selection time) | ||
193 | (define-xevent->subevent xselectionrequest | ||
194 | type serial send_event display owner requestor selection | ||
195 | target property time) | ||
196 | (define-xevent->subevent xselection | ||
197 | type serial send_event display requestor selection | ||
198 | target property time) | ||
199 | (define-xevent->subevent xcolormap | ||
200 | type serial send_event display window colormap new state) | ||
201 | (define-xevent->subevent xmapping | ||
202 | type serial send_event display window request first_keycode count) | ||
203 | (define-xevent->subevent xerror | ||
204 | type display resourceid serial | ||
205 | error_code request_code minor_code) | ||
206 | ;; (define-xevent->subevent xfocuschange) | ||
207 | #;(define-xevent->subevent xclient | ||
208 | type serial send_event display window message_type format | ||
209 | data-b data-s data-l) | ||
210 | #;(define-xevent->subevent xkeymap | ||
211 | type serial send_event display window key_vector) | ||
212 | |||
213 | ;;; Keysyms, keycodes, etc. | ||
214 | |||
215 | (define (keysym->keycode ks #!optional (dpy (get-display))) | ||
216 | (char->integer (xkeysymtokeycode dpy ks))) | ||
217 | |||
218 | (define-public (symbol->keysym xk_symbol) | ||
219 | ;;; XK_<NAME> => <the integer defined by XK_<NAME>> | ||
220 | (let ((ks (alist-ref xk_symbol keysyms))) | ||
221 | (and ks ks))) | ||
222 | |||
223 | (define-public (->keycode keysym/xk_symbol #!optional (dpy (get-display))) | ||
224 | ;; Because it's all integers at the bottom, this function assumes that its | ||
225 | ;; argument denotes a Keysym. | ||
226 | (cond | ||
227 | ((number? keysym/xk_symbol) | ||
228 | (keysym->keycode keysym/xk_symbol)) | ||
229 | ((symbol? keysym/xk_symbol) | ||
230 | (keysym->keycode (symbol->keysym keysym/xk_symbol))) | ||
231 | ((char? keysym/xk_symbol) ; a weird situation but w/e | ||
232 | (char->integer keysym/xk_symbol)) | ||
233 | (else #f))) | ||
234 | |||
235 | (define keysyms | ||
236 | `((XK_BACKSPACE . ,XK_BACKSPACE) | ||
237 | (XK_0 . ,XK_0) | ||
238 | (XK_1 . ,XK_1) | ||
239 | (XK_2 . ,XK_2) | ||
240 | (XK_3 . ,XK_3) | ||
241 | (XK_4 . ,XK_4) | ||
242 | (XK_5 . ,XK_5) | ||
243 | (XK_6 . ,XK_6) | ||
244 | (XK_7 . ,XK_7) | ||
245 | (XK_8 . ,XK_8) | ||
246 | (XK_9 . ,XK_9) | ||
247 | (XK_A . ,XK_A) | ||
248 | (XK_AACUTE . ,XK_AACUTE) | ||
249 | (XK_ACIRCUMFLEX . ,XK_ACIRCUMFLEX) | ||
250 | (XK_ACUTE . ,XK_ACUTE) | ||
251 | (XK_ADIAERESIS . ,XK_ADIAERESIS) | ||
252 | (XK_AE . ,XK_AE) | ||
253 | (XK_AGRAVE . ,XK_AGRAVE) | ||
254 | (XK_ALT_L . ,XK_ALT_L) | ||
255 | (XK_ALT_R . ,XK_ALT_R) | ||
256 | (XK_AMPERSAND . ,XK_AMPERSAND) | ||
257 | (XK_ARING . ,XK_ARING) | ||
258 | (XK_ASCIICIRCUM . ,XK_ASCIICIRCUM) | ||
259 | (XK_ASCIITILDE . ,XK_ASCIITILDE) | ||
260 | (XK_ASTERISK . ,XK_ASTERISK) | ||
261 | (XK_AT . ,XK_AT) | ||
262 | (XK_ATILDE . ,XK_ATILDE) | ||
263 | (XK_B . ,XK_B) | ||
264 | (XK_BACKSLASH . ,XK_BACKSLASH) | ||
265 | (XK_BAR . ,XK_BAR) | ||
266 | (XK_BEGIN . ,XK_BEGIN) | ||
267 | (XK_BRACELEFT . ,XK_BRACELEFT) | ||
268 | (XK_BRACERIGHT . ,XK_BRACERIGHT) | ||
269 | (XK_BRACKETLEFT . ,XK_BRACKETLEFT) | ||
270 | (XK_BRACKETRIGHT . ,XK_BRACKETRIGHT) | ||
271 | (XK_BREAK . ,XK_BREAK) | ||
272 | (XK_BROKENBAR . ,XK_BROKENBAR) | ||
273 | (XK_C . ,XK_C) | ||
274 | (XK_CANCEL . ,XK_CANCEL) | ||
275 | (XK_CAPS_LOCK . ,XK_CAPS_LOCK) | ||
276 | (XK_CCEDILLA . ,XK_CCEDILLA) | ||
277 | (XK_CEDILLA . ,XK_CEDILLA) | ||
278 | (XK_CENT . ,XK_CENT) | ||
279 | (XK_CLEAR . ,XK_CLEAR) | ||
280 | (XK_COLON . ,XK_COLON) | ||
281 | (XK_COMMA . ,XK_COMMA) | ||
282 | (XK_CONTROL_L . ,XK_CONTROL_L) | ||
283 | (XK_CONTROL_R . ,XK_CONTROL_R) | ||
284 | (XK_COPYRIGHT . ,XK_COPYRIGHT) | ||
285 | (XK_CURRENCY . ,XK_CURRENCY) | ||
286 | (XK_D . ,XK_D) | ||
287 | (XK_DEGREE . ,XK_DEGREE) | ||
288 | (XK_DELETE . ,XK_DELETE) | ||
289 | (XK_DIAERESIS . ,XK_DIAERESIS) | ||
290 | (XK_DIVISION . ,XK_DIVISION) | ||
291 | (XK_DOLLAR . ,XK_DOLLAR) | ||
292 | (XK_DOWN . ,XK_DOWN) | ||
293 | (XK_E . ,XK_E) | ||
294 | (XK_EACUTE . ,XK_EACUTE) | ||
295 | (XK_ECIRCUMFLEX . ,XK_ECIRCUMFLEX) | ||
296 | (XK_EDIAERESIS . ,XK_EDIAERESIS) | ||
297 | (XK_EGRAVE . ,XK_EGRAVE) | ||
298 | (XK_END . ,XK_END) | ||
299 | (XK_EQUAL . ,XK_EQUAL) | ||
300 | (XK_ESCAPE . ,XK_ESCAPE) | ||
301 | (XK_ETH . ,XK_ETH) | ||
302 | (XK_EXCLAM . ,XK_EXCLAM) | ||
303 | (XK_EXCLAMDOWN . ,XK_EXCLAMDOWN) | ||
304 | (XK_EXECUTE . ,XK_EXECUTE) | ||
305 | (XK_F . ,XK_F) | ||
306 | (XK_F1 . ,XK_F1) | ||
307 | (XK_F10 . ,XK_F10) | ||
308 | (XK_F11 . ,XK_F11) | ||
309 | (XK_F12 . ,XK_F12) | ||
310 | (XK_F13 . ,XK_F13) | ||
311 | (XK_F14 . ,XK_F14) | ||
312 | (XK_F15 . ,XK_F15) | ||
313 | (XK_F16 . ,XK_F16) | ||
314 | (XK_F17 . ,XK_F17) | ||
315 | (XK_F18 . ,XK_F18) | ||
316 | (XK_F19 . ,XK_F19) | ||
317 | (XK_F2 . ,XK_F2) | ||
318 | (XK_F20 . ,XK_F20) | ||
319 | (XK_F21 . ,XK_F21) | ||
320 | (XK_F22 . ,XK_F22) | ||
321 | (XK_F23 . ,XK_F23) | ||
322 | (XK_F24 . ,XK_F24) | ||
323 | (XK_F25 . ,XK_F25) | ||
324 | (XK_F26 . ,XK_F26) | ||
325 | (XK_F27 . ,XK_F27) | ||
326 | (XK_F28 . ,XK_F28) | ||
327 | (XK_F29 . ,XK_F29) | ||
328 | (XK_F3 . ,XK_F3) | ||
329 | (XK_F30 . ,XK_F30) | ||
330 | (XK_F31 . ,XK_F31) | ||
331 | (XK_F32 . ,XK_F32) | ||
332 | (XK_F33 . ,XK_F33) | ||
333 | (XK_F34 . ,XK_F34) | ||
334 | (XK_F35 . ,XK_F35) | ||
335 | (XK_F4 . ,XK_F4) | ||
336 | (XK_F5 . ,XK_F5) | ||
337 | (XK_F6 . ,XK_F6) | ||
338 | (XK_F7 . ,XK_F7) | ||
339 | (XK_F8 . ,XK_F8) | ||
340 | (XK_F9 . ,XK_F9) | ||
341 | (XK_FIND . ,XK_FIND) | ||
342 | (XK_G . ,XK_G) | ||
343 | (XK_GREATER . ,XK_GREATER) | ||
344 | (XK_GUILLEMOTLEFT . ,XK_GUILLEMOTLEFT) | ||
345 | (XK_GUILLEMOTRIGHT . ,XK_GUILLEMOTRIGHT) | ||
346 | (XK_H . ,XK_H) | ||
347 | (XK_HELP . ,XK_HELP) | ||
348 | (XK_HOME . ,XK_HOME) | ||
349 | (XK_HYPER_L . ,XK_HYPER_L) | ||
350 | (XK_HYPER_R . ,XK_HYPER_R) | ||
351 | (XK_HYPHEN . ,XK_HYPHEN) | ||
352 | (XK_I . ,XK_I) | ||
353 | (XK_IACUTE . ,XK_IACUTE) | ||
354 | (XK_ICIRCUMFLEX . ,XK_ICIRCUMFLEX) | ||
355 | (XK_IDIAERESIS . ,XK_IDIAERESIS) | ||
356 | (XK_IGRAVE . ,XK_IGRAVE) | ||
357 | (XK_INSERT . ,XK_INSERT) | ||
358 | (XK_J . ,XK_J) | ||
359 | (XK_K . ,XK_K) | ||
360 | (XK_KANJI . ,XK_KANJI) | ||
361 | (XK_KP_0 . ,XK_KP_0) | ||
362 | (XK_KP_1 . ,XK_KP_1) | ||
363 | (XK_KP_2 . ,XK_KP_2) | ||
364 | (XK_KP_3 . ,XK_KP_3) | ||
365 | (XK_KP_4 . ,XK_KP_4) | ||
366 | (XK_KP_5 . ,XK_KP_5) | ||
367 | (XK_KP_6 . ,XK_KP_6) | ||
368 | (XK_KP_7 . ,XK_KP_7) | ||
369 | (XK_KP_8 . ,XK_KP_8) | ||
370 | (XK_KP_9 . ,XK_KP_9) | ||
371 | (XK_KP_ADD . ,XK_KP_ADD) | ||
372 | (XK_KP_DECIMAL . ,XK_KP_DECIMAL) | ||
373 | (XK_KP_DIVIDE . ,XK_KP_DIVIDE) | ||
374 | (XK_KP_ENTER . ,XK_KP_ENTER) | ||
375 | (XK_KP_EQUAL . ,XK_KP_EQUAL) | ||
376 | (XK_KP_F1 . ,XK_KP_F1) | ||
377 | (XK_KP_F2 . ,XK_KP_F2) | ||
378 | (XK_KP_F3 . ,XK_KP_F3) | ||
379 | (XK_KP_F4 . ,XK_KP_F4) | ||
380 | (XK_KP_MULTIPLY . ,XK_KP_MULTIPLY) | ||
381 | (XK_KP_SEPARATOR . ,XK_KP_SEPARATOR) | ||
382 | (XK_KP_SPACE . ,XK_KP_SPACE) | ||
383 | (XK_KP_SUBTRACT . ,XK_KP_SUBTRACT) | ||
384 | (XK_KP_TAB . ,XK_KP_TAB) | ||
385 | (XK_L . ,XK_L) | ||
386 | (XK_L1 . ,XK_L1) | ||
387 | (XK_L10 . ,XK_L10) | ||
388 | (XK_L2 . ,XK_L2) | ||
389 | (XK_L3 . ,XK_L3) | ||
390 | (XK_L4 . ,XK_L4) | ||
391 | (XK_L5 . ,XK_L5) | ||
392 | (XK_L6 . ,XK_L6) | ||
393 | (XK_L7 . ,XK_L7) | ||
394 | (XK_L8 . ,XK_L8) | ||
395 | (XK_L9 . ,XK_L9) | ||
396 | (XK_LCA . ,XK_LCA) | ||
397 | (XK_LCAACUTE . ,XK_LCAACUTE) | ||
398 | (XK_LCACIRCUMFLEX . ,XK_LCACIRCUMFLEX) | ||
399 | (XK_LCADIAERESIS . ,XK_LCADIAERESIS) | ||
400 | (XK_LCAE . ,XK_LCAE) | ||
401 | (XK_LCAGRAVE . ,XK_LCAGRAVE) | ||
402 | (XK_LCARING . ,XK_LCARING) | ||
403 | (XK_LCATILDE . ,XK_LCATILDE) | ||
404 | (XK_LCB . ,XK_LCB) | ||
405 | (XK_LCC . ,XK_LCC) | ||
406 | (XK_LCCCEDILLA . ,XK_LCCCEDILLA) | ||
407 | (XK_LCD . ,XK_LCD) | ||
408 | (XK_LCE . ,XK_LCE) | ||
409 | (XK_LCEACUTE . ,XK_LCEACUTE) | ||
410 | (XK_LCECIRCUMFLEX . ,XK_LCECIRCUMFLEX) | ||
411 | (XK_LCEDIAERESIS . ,XK_LCEDIAERESIS) | ||
412 | (XK_LCEGRAVE . ,XK_LCEGRAVE) | ||
413 | (XK_LCETH . ,XK_LCETH) | ||
414 | (XK_LCF . ,XK_LCF) | ||
415 | (XK_LCG . ,XK_LCG) | ||
416 | (XK_LCH . ,XK_LCH) | ||
417 | (XK_LCI . ,XK_LCI) | ||
418 | (XK_LCIACUTE . ,XK_LCIACUTE) | ||
419 | (XK_LCICIRCUMFLEX . ,XK_LCICIRCUMFLEX) | ||
420 | (XK_LCIDIAERESIS . ,XK_LCIDIAERESIS) | ||
421 | (XK_LCIGRAVE . ,XK_LCIGRAVE) | ||
422 | (XK_LCJ . ,XK_LCJ) | ||
423 | (XK_LCK . ,XK_LCK) | ||
424 | (XK_LCL . ,XK_LCL) | ||
425 | (XK_LCM . ,XK_LCM) | ||
426 | (XK_LCN . ,XK_LCN) | ||
427 | (XK_LCNTILDE . ,XK_LCNTILDE) | ||
428 | (XK_LCO . ,XK_LCO) | ||
429 | (XK_LCOACUTE . ,XK_LCOACUTE) | ||
430 | (XK_LCOCIRCUMFLEX . ,XK_LCOCIRCUMFLEX) | ||
431 | (XK_LCODIAERESIS . ,XK_LCODIAERESIS) | ||
432 | (XK_LCOGRAVE . ,XK_LCOGRAVE) | ||
433 | (XK_LCOTILDE . ,XK_LCOTILDE) | ||
434 | (XK_LCP . ,XK_LCP) | ||
435 | (XK_LCQ . ,XK_LCQ) | ||
436 | (XK_LCR . ,XK_LCR) | ||
437 | (XK_LCS . ,XK_LCS) | ||
438 | (XK_LCT . ,XK_LCT) | ||
439 | (XK_LCTHORN . ,XK_LCTHORN) | ||
440 | (XK_LCU . ,XK_LCU) | ||
441 | (XK_LCUACUTE . ,XK_LCUACUTE) | ||
442 | (XK_LCUCIRCUMFLEX . ,XK_LCUCIRCUMFLEX) | ||
443 | (XK_LCUDIAERESIS . ,XK_LCUDIAERESIS) | ||
444 | (XK_LCUGRAVE . ,XK_LCUGRAVE) | ||
445 | (XK_LCV . ,XK_LCV) | ||
446 | (XK_LCW . ,XK_LCW) | ||
447 | (XK_LCX . ,XK_LCX) | ||
448 | (XK_LCY . ,XK_LCY) | ||
449 | (XK_LCYACUTE . ,XK_LCYACUTE) | ||
450 | (XK_LCZ . ,XK_LCZ) | ||
451 | (XK_LEFT . ,XK_LEFT) | ||
452 | (XK_LESS . ,XK_LESS) | ||
453 | (XK_LINEFEED . ,XK_LINEFEED) | ||
454 | (XK_M . ,XK_M) | ||
455 | (XK_MACRON . ,XK_MACRON) | ||
456 | (XK_MASCULINE . ,XK_MASCULINE) | ||
457 | (XK_MENU . ,XK_MENU) | ||
458 | (XK_META_L . ,XK_META_L) | ||
459 | (XK_META_R . ,XK_META_R) | ||
460 | (XK_MINUS . ,XK_MINUS) | ||
461 | (XK_MODE_SWITCH . ,XK_MODE_SWITCH) | ||
462 | (XK_MU . ,XK_MU) | ||
463 | (XK_MULTIPLY . ,XK_MULTIPLY) | ||
464 | (XK_MULTI_KEY . ,XK_MULTI_KEY) | ||
465 | (XK_N . ,XK_N) | ||
466 | (XK_NEXT . ,XK_NEXT) | ||
467 | (XK_NOBREAKSPACE . ,XK_NOBREAKSPACE) | ||
468 | (XK_NOTSIGN . ,XK_NOTSIGN) | ||
469 | (XK_NTILDE . ,XK_NTILDE) | ||
470 | (XK_NUMBERSIGN . ,XK_NUMBERSIGN) | ||
471 | (XK_NUM_LOCK . ,XK_NUM_LOCK) | ||
472 | (XK_O . ,XK_O) | ||
473 | (XK_OACUTE . ,XK_OACUTE) | ||
474 | (XK_OCIRCUMFLEX . ,XK_OCIRCUMFLEX) | ||
475 | (XK_ODIAERESIS . ,XK_ODIAERESIS) | ||
476 | (XK_OGRAVE . ,XK_OGRAVE) | ||
477 | (XK_ONEHALF . ,XK_ONEHALF) | ||
478 | (XK_ONEQUARTER . ,XK_ONEQUARTER) | ||
479 | (XK_ONESUPERIOR . ,XK_ONESUPERIOR) | ||
480 | (XK_OOBLIQUE . ,XK_OOBLIQUE) | ||
481 | (XK_ORDFEMININE . ,XK_ORDFEMININE) | ||
482 | (XK_OSLASH . ,XK_OSLASH) | ||
483 | (XK_OTILDE . ,XK_OTILDE) | ||
484 | (XK_P . ,XK_P) | ||
485 | (XK_PARAGRAPH . ,XK_PARAGRAPH) | ||
486 | (XK_PARENLEFT . ,XK_PARENLEFT) | ||
487 | (XK_PARENRIGHT . ,XK_PARENRIGHT) | ||
488 | (XK_PAUSE . ,XK_PAUSE) | ||
489 | (XK_PERCENT . ,XK_PERCENT) | ||
490 | (XK_PERIOD . ,XK_PERIOD) | ||
491 | (XK_PERIODCENTERED . ,XK_PERIODCENTERED) | ||
492 | (XK_PLUS . ,XK_PLUS) | ||
493 | (XK_PLUSMINUS . ,XK_PLUSMINUS) | ||
494 | (XK_PRINT . ,XK_PRINT) | ||
495 | (XK_PRIOR . ,XK_PRIOR) | ||
496 | (XK_Q . ,XK_Q) | ||
497 | (XK_QUESTION . ,XK_QUESTION) | ||
498 | (XK_QUESTIONDOWN . ,XK_QUESTIONDOWN) | ||
499 | (XK_QUOTEDBL . ,XK_QUOTEDBL) | ||
500 | (XK_QUOTELEFT . ,XK_QUOTELEFT) | ||
501 | (XK_QUOTERIGHT . ,XK_QUOTERIGHT) | ||
502 | (XK_R . ,XK_R) | ||
503 | (XK_R1 . ,XK_R1) | ||
504 | (XK_R10 . ,XK_R10) | ||
505 | (XK_R11 . ,XK_R11) | ||
506 | (XK_R12 . ,XK_R12) | ||
507 | (XK_R13 . ,XK_R13) | ||
508 | (XK_R14 . ,XK_R14) | ||
509 | (XK_R15 . ,XK_R15) | ||
510 | (XK_R2 . ,XK_R2) | ||
511 | (XK_R3 . ,XK_R3) | ||
512 | (XK_R4 . ,XK_R4) | ||
513 | (XK_R5 . ,XK_R5) | ||
514 | (XK_R6 . ,XK_R6) | ||
515 | (XK_R7 . ,XK_R7) | ||
516 | (XK_R8 . ,XK_R8) | ||
517 | (XK_R9 . ,XK_R9) | ||
518 | (XK_REDO . ,XK_REDO) | ||
519 | (XK_REGISTERED . ,XK_REGISTERED) | ||
520 | (XK_RETURN . ,XK_RETURN) | ||
521 | (XK_RIGHT . ,XK_RIGHT) | ||
522 | (XK_S . ,XK_S) | ||
523 | (XK_SCRIPT_SWITCH . ,XK_SCRIPT_SWITCH) | ||
524 | (XK_SECTION . ,XK_SECTION) | ||
525 | (XK_SELECT . ,XK_SELECT) | ||
526 | (XK_SEMICOLON . ,XK_SEMICOLON) | ||
527 | (XK_SHIFT_L . ,XK_SHIFT_L) | ||
528 | (XK_SHIFT_LOCK . ,XK_SHIFT_LOCK) | ||
529 | (XK_SHIFT_R . ,XK_SHIFT_R) | ||
530 | (XK_SLASH . ,XK_SLASH) | ||
531 | (XK_SPACE . ,XK_SPACE) | ||
532 | (XK_SSHARP . ,XK_SSHARP) | ||
533 | (XK_STERLING . ,XK_STERLING) | ||
534 | (XK_SUPER_L . ,XK_SUPER_L) | ||
535 | (XK_SUPER_R . ,XK_SUPER_R) | ||
536 | (XK_T . ,XK_T) | ||
537 | (XK_TAB . ,XK_TAB) | ||
538 | (XK_THORN . ,XK_THORN) | ||
539 | (XK_THREEQUARTERS . ,XK_THREEQUARTERS) | ||
540 | (XK_THREESUPERIOR . ,XK_THREESUPERIOR) | ||
541 | (XK_TWOSUPERIOR . ,XK_TWOSUPERIOR) | ||
542 | (XK_U . ,XK_U) | ||
543 | (XK_UACUTE . ,XK_UACUTE) | ||
544 | (XK_UCIRCUMFLEX . ,XK_UCIRCUMFLEX) | ||
545 | (XK_UDIAERESIS . ,XK_UDIAERESIS) | ||
546 | (XK_UGRAVE . ,XK_UGRAVE) | ||
547 | (XK_UNDERSCORE . ,XK_UNDERSCORE) | ||
548 | (XK_UNDO . ,XK_UNDO) | ||
549 | (XK_UP . ,XK_UP) | ||
550 | (XK_V . ,XK_V) | ||
551 | (XK_W . ,XK_W) | ||
552 | (XK_X . ,XK_X) | ||
553 | (XK_Y . ,XK_Y) | ||
554 | (XK_YACUTE . ,XK_YACUTE) | ||
555 | (XK_YDIAERESIS . ,XK_YDIAERESIS) | ||
556 | (XK_YEN . ,XK_YEN) | ||
557 | (XK_Z . ,XK_Z) | ||
558 | (DXK_ACUTE_ACCENT . ,DXK_ACUTE_ACCENT) | ||
559 | (DXK_CEDILLA_ACCENT . ,DXK_CEDILLA_ACCENT) | ||
560 | (DXK_CIRCUMFLEX_ACCENT . ,DXK_CIRCUMFLEX_ACCENT) | ||
561 | (DXK_DIAERESIS . ,DXK_DIAERESIS) | ||
562 | (DXK_GRAVE_ACCENT . ,DXK_GRAVE_ACCENT) | ||
563 | (DXK_REMOVE . ,DXK_REMOVE) | ||
564 | (DXK_RING_ACCENT . ,DXK_RING_ACCENT) | ||
565 | (DXK_TILDE . ,DXK_TILDE))) | ||
566 | |||
567 | ;;; Debugging | ||
568 | |||
569 | (define xevent-types | ||
570 | `((,KEYPRESS . KEYPRESS) | ||
571 | (,KEYRELEASE . KEYRELEASE) | ||
572 | (,BUTTONPRESS . BUTTONPRESS) | ||
573 | (,BUTTONRELEASE . BUTTONRELEASE) | ||
574 | (,MOTIONNOTIFY . MOTIONNOTIFY) | ||
575 | (,ENTERNOTIFY . ENTERNOTIFY) | ||
576 | (,LEAVENOTIFY . LEAVENOTIFY) | ||
577 | (,FOCUSIN . FOCUSIN) | ||
578 | (,FOCUSOUT . FOCUSOUT) | ||
579 | (,KEYMAPNOTIFY . KEYMAPNOTIFY) | ||
580 | (,EXPOSE . EXPOSE) | ||
581 | (,GRAPHICSEXPOSE . GRAPHICSEXPOSE) | ||
582 | (,NOEXPOSE . NOEXPOSE) | ||
583 | (,VISIBILITYNOTIFY . VISIBILITYNOTIFY) | ||
584 | (,CREATENOTIFY . CREATENOTIFY) | ||
585 | (,DESTROYNOTIFY . DESTROYNOTIFY) | ||
586 | (,UNMAPNOTIFY . UNMAPNOTIFY) | ||
587 | (,MAPNOTIFY . MAPNOTIFY) | ||
588 | (,MAPREQUEST . MAPREQUEST) | ||
589 | (,REPARENTNOTIFY . REPARENTNOTIFY) | ||
590 | (,CONFIGURENOTIFY . CONFIGURENOTIFY) | ||
591 | (,CONFIGUREREQUEST . CONFIGUREREQUEST) | ||
592 | (,GRAVITYNOTIFY . GRAVITYNOTIFY) | ||
593 | (,RESIZEREQUEST . RESIZEREQUEST) | ||
594 | (,CIRCULATENOTIFY . CIRCULATENOTIFY) | ||
595 | (,CIRCULATEREQUEST . CIRCULATEREQUEST) | ||
596 | (,PROPERTYNOTIFY . PROPERTYNOTIFY) | ||
597 | (,SELECTIONCLEAR . SELECTIONCLEAR) | ||
598 | (,SELECTIONREQUEST . SELECTIONREQUEST) | ||
599 | (,SELECTIONNOTIFY . SELECTIONNOTIFY) | ||
600 | (,COLORMAPNOTIFY . COLORMAPNOTIFY) | ||
601 | (,CLIENTMESSAGE . CLIENTMESSAGE) | ||
602 | (,MAPPINGNOTIFY . MAPPINGNOTIFY) | ||
603 | #;(,GENERICEVENT . GENERICEVENT))) | ||
604 | |||
605 | (define-public (xevent-type-name type) | ||
606 | (let ((x (assq type xevent-types))) | ||
607 | (and x (cdr x)))) | ||