2003-03-10 21:47:38 -05:00
|
|
|
;; Copyright (c) 2001-2003 by David Frese
|
2001-10-04 08:21:25 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; a keysym is a 16-bit protocol ID (see X11/keysymdef.h)
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; a keycode is an integer specifying a single key on the keyboard
|
|
|
|
;; (hardware depended)
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** manipulate keyboard encoding **********************************
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; a keyboard mapping is a list of lists of keysyms
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function change-keyboard-mapping
|
2003-03-10 21:47:38 -05:00
|
|
|
(display first-keycode keysyms-lists)
|
|
|
|
"scx_Change_Keyboard_Mapping")
|
2001-10-04 08:21:25 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; returns keycode-count lists of keysyms
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function get-keyboard-mapping
|
2003-03-10 21:47:38 -05:00
|
|
|
(display first-keycode keycode-count)
|
|
|
|
"scx_Get_Keyboard_Mapping")
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; returns a pair (min-keycodes . max-keycodes)
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function display-keycodes (display)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Display_Keycodes")
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; a modmap is an alist mapping a modifier to a list of
|
|
|
|
;; keycodes. Valid modifiers are (state shift) (state lock) (state
|
|
|
|
;; control) (state mod1) (state mod2) (state mod3) (state mod4)
|
|
|
|
;; (state mod5)
|
2001-10-04 08:21:25 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function set-modifier-mapping (display modmap)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Set_Modifier_Mapping")
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function get-modifier-mapping (display)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Get_Modifier_Mapping")
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** convert keysyms ***********************************************
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition string->keysym (string)
|
|
|
|
"scx_String_To_Keysym")
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition keysym->string (keysym)
|
|
|
|
"scx_Keysym_To_String")
|
2001-10-04 08:21:25 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; TODO include X11/keysymdef.h ??
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function keycode->keysym (display keycode index)
|
2001-08-22 07:50:05 -04:00
|
|
|
"scx_Keycode_To_Keysym")
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function keysym->keycode (display keysym)
|
2001-08-22 07:50:05 -04:00
|
|
|
"scx_Keysym_To_Keycode")
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; returns a pair (lower . upper)
|
|
|
|
(import-lambda-definition convert-case (keysym)
|
|
|
|
"scx_Convert_Case")
|
2001-10-04 08:21:25 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (convert-to-lowercase keysym)
|
|
|
|
(car (convert-case keysym)))
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (convert-to-uppercase keysym)
|
|
|
|
(cdr (convert-case keysym)))
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** handle keyboard input events in Latin-1 ***********************
|
2001-10-04 08:21:25 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-lambda-definition %lookup-keysym (key-event index)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Lookup_Keysym")
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(define (lookup-keysym key-event index)
|
|
|
|
(call-xlib-function (key-event-display key-event) 'lookup-keysym
|
|
|
|
(lambda () (%lookup-keysym key-event index))))
|
|
|
|
|
|
|
|
(import-lambda-definition %refresh-keyboard-mapping (mapping-event)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Refresh_Keyboard_Mapping")
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(define (refresh-keyboard-mapping mapping-event)
|
|
|
|
(call-xlib-function (mapping-event-display mapping-event)
|
|
|
|
'refresh-keyboard-mapping
|
|
|
|
(lambda () (%refresh-keyboard-mapping mapping-event))))
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; returns a pair (keysym . string)
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-lambda-definition %lookup-string/keysym (key-event)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Lookup_String")
|
2001-10-04 08:21:25 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(define (lookup-string/keysym key-event)
|
|
|
|
(call-xlib-function (key-event-display key-event)
|
|
|
|
'lookup-string/keysym
|
|
|
|
(lambda () (%lookup-string/keysym key-event))))
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (lookup-string key-event)
|
|
|
|
(cdr (lookup-string/keysym key-event)))
|
2001-08-22 07:50:05 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function rebind-keysym (display keysym mod-keysyms string)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Rebind_Keysym")
|