+ fixed bugs in scx_Display_Keycodes_Per_Keysym and
scx_Keycode_To_Keysym. + added comments.
This commit is contained in:
		
							parent
							
								
									45c05c8475
								
							
						
					
					
						commit
						f388edb0f1
					
				| 
						 | 
				
			
			@ -27,6 +27,7 @@ s48_value scx_Display_Keysyms_Per_Keycode (s48_value d) {
 | 
			
		|||
  XDisplayKeycodes(SCX_EXTRACT_DISPLAY(d), &mink, &maxk);
 | 
			
		||||
  ksyms = XGetKeyboardMapping(SCX_EXTRACT_DISPLAY(d), (KeyCode)mink,
 | 
			
		||||
			      maxk - mink + 1, &ksyms_per_kode);
 | 
			
		||||
  XFree(ksyms);
 | 
			
		||||
  return s48_enter_integer(ksyms_per_kode);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -58,7 +59,8 @@ s48_value scx_Keycode_To_Keysym (s48_value d, s48_value k, s48_value index) {
 | 
			
		|||
			(int)s48_extract_integer (k), 
 | 
			
		||||
			(int)s48_extract_integer (index));
 | 
			
		||||
  //Enable_Interrupts;
 | 
			
		||||
  return s48_enter_integer((unsigned long)ks);
 | 
			
		||||
  if (ks == NoSymbol) return S48_FALSE;
 | 
			
		||||
  else return s48_enter_integer((unsigned long)ks);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
s48_value scx_Keysym_To_Keycode (s48_value d, s48_value k) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,5 @@
 | 
			
		|||
;; for display-min/max-keycode see XDisplayKeycodes.
 | 
			
		||||
 | 
			
		||||
(define (display-min-keycode display)
 | 
			
		||||
  (%display-min-keycode (display-Xdisplay display)))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -10,12 +12,20 @@
 | 
			
		|||
(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)
 | 
			
		||||
| 
						 | 
				
			
			@ -30,6 +40,10 @@
 | 
			
		|||
(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))
 | 
			
		||||
| 
						 | 
				
			
			@ -37,6 +51,10 @@
 | 
			
		|||
(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))
 | 
			
		||||
| 
						 | 
				
			
			@ -44,6 +62,10 @@
 | 
			
		|||
(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 mask))
 | 
			
		||||
| 
						 | 
				
			
			@ -51,6 +73,10 @@
 | 
			
		|||
(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
 | 
			
		||||
| 
						 | 
				
			
			@ -60,10 +86,16 @@
 | 
			
		|||
(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)
 | 
			
		||||
			     type))
 | 
			
		||||
 | 
			
		||||
(import-lambda-definition %refresh-keyboard-mapping (Xdisplay Xwindow type)
 | 
			
		||||
  "scx_Refresh_Keyboard_Mapping")
 | 
			
		||||
  "scx_Refresh_Keyboard_Mapping")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue