103 lines
3.3 KiB
Scheme
103 lines
3.3 KiB
Scheme
;; for display-min/max-keycode see XDisplayKeycodes.
|
|
|
|
(define (display-min-keycode display)
|
|
(%display-min-keycode (display-Xdisplay display)))
|
|
|
|
(import-lambda-definition %display-min-keycode (Xdisplay)
|
|
"scx_Display_Min_Keycode")
|
|
|
|
(define (display-max-keycode display)
|
|
(%display-max-keycode (display-Xdisplay display)))
|
|
|
|
(import-lambda-definition %display-max-keycode (Xdisplay)
|
|
"scx_Display_Max_Keycode")
|
|
|
|
;; display-keysyms-per-keycode returns the number of keysyms per
|
|
;; keycode. See XGetKeyboardMapping.
|
|
|
|
(define (display-keysyms-per-keycode display)
|
|
(%display-keysyms-per-keycode (display-Xdisplay display)))
|
|
|
|
(import-lambda-definition %display-keysyms-per-keycode (Xdisplay)
|
|
"scx_Display_Keysyms_Per_Keycode")
|
|
|
|
;; Standard KeySym names are obtained from <X11/keysymdef.h> by
|
|
;; removing the XK_ prefix from each name. But there may also be
|
|
;; implementation dependand names. See XStringToKeysym or
|
|
;; XKeysymToString.
|
|
|
|
(define (string->keysym string)
|
|
(%string->keysym (if (symbol? string)
|
|
(symbol->string string)
|
|
string)))
|
|
|
|
(import-lambda-definition %string->keysym (s)
|
|
"scx_String_To_Keysym")
|
|
|
|
(define (keysym->string keysym)
|
|
(%keysym->string keysym))
|
|
|
|
(import-lambda-definition %keysym->string (k)
|
|
"scx_Keysym_To_String")
|
|
|
|
;; keycode->keysym uses internal Xlib tables to return the KeySym
|
|
;; defined for the specified KeyCode. If no symbol is defined false is
|
|
;; returned. See XKeycodeToKeysym.
|
|
|
|
(define (keycode->keysym display keycode index)
|
|
(%keycode->keysym (display-Xdisplay display)
|
|
keycode index))
|
|
|
|
(import-lambda-definition %keycode->keysym (Xdisplay kc i)
|
|
"scx_Keycode_To_Keysym")
|
|
|
|
;; keysym->keycode returns the defined keycode for the specified
|
|
;; keysym. If the keysym is not defined then 0 is returned. See
|
|
;; XKeysymToKeycode.
|
|
|
|
(define (keysym->keycode display keysym)
|
|
(%keysym->keycode (display-Xdisplay display)
|
|
keysym))
|
|
|
|
(import-lambda-definition %keysym->keycode (Xdisplay ks)
|
|
"scx_Keysym_To_Keycode")
|
|
|
|
;; lookup-string translates a keycode and a modifier mask, as obtained
|
|
;; from a key event, to a key name (like the ones returned by
|
|
;; keysym->string). See XLookupString.
|
|
|
|
(define (lookup-string display keycode mask)
|
|
(%lookup-string (display-Xdisplay display)
|
|
keycode
|
|
(state-set->integer mask)))
|
|
|
|
(import-lambda-definition %lookup-string (Xdisplay kc m)
|
|
"scx_Lookup_String")
|
|
|
|
;; rebind-keysym rebinds the meaning of a keysym/modifier pair for the
|
|
;; client. It does not redefine any key in the X server. lookup-string
|
|
;; returns this string afterwards. See XRebindKeysym.
|
|
|
|
(define (rebind-keysym display keysym modifiers string)
|
|
(%rebind-keysym (display-Xdisplay display)
|
|
keysym
|
|
(list->vector modifiers)
|
|
string))
|
|
|
|
(import-lambda-definition %rebind-keysym (Xdisplay ks mods str)
|
|
"scx_Rebind_Keysym")
|
|
|
|
;; refresh-keyboard-mapping refreshes the stored modifier and keymap
|
|
;; information. You usually call this function when a MappingNotify
|
|
;; event with a request member of MappingKeyboard or MappingModifier
|
|
;; occurs. The result is to update Xlib's knowledge of the
|
|
;; keyboard. See XRefreshKeyboardMapping.
|
|
|
|
(define (refresh-keyboard-mapping window type)
|
|
(%refresh-keyboard-mapping (display-Xdisplay (window-display window))
|
|
(window-Xwindow window)
|
|
(mapping-request->integer type)))
|
|
|
|
(import-lambda-definition %refresh-keyboard-mapping (Xdisplay Xwindow type)
|
|
"scx_Refresh_Keyboard_Mapping")
|