Dynamic binding of keyname/keysym.

Erik Enge erik at nittin.net
Sun Mar 2 20:48:00 UTC 2003


hatchond at labri.fr writes:

> Should be normal. Because we don't handle the :mapping-notify event (clx
> 12.12.3), but we should handle it. If you look at the definition of this event,
> you'll see that we have a chance to handle this correctly. 
> But first, I would like to know what happens if you change the keyboard map
> before lunching eclipse ? I don't figure how to handle a :mapping-notify with
> request :keyboard correctly for the moment, maybe you do.
> I was waiting for somebody like you (with strange keyboard mapping) to point
> this out. (I wasn't sure of the necessity of handling this event before :o( )
[snip]
> The trouble is: I don't have the (even the begining of) solution in my
> mind for the moment

According to the CLX (12.12.3), if REQUEST is :KEYBOARD then START and
COUNT indicate the range of the altered keycodes.

A snip from my ~/.Xmodmap file:

  keycode 100 = Left
  keycode 101 =
  keycode 102 = Right
  keycode 103 = End
  keycode 104 = Down
  keycode 105 = Next
  keycode 106 = Insert
  keycode 107 = Delete
  keycode 108 = KP_Enter
  keycode 109 = Control_R
  keycode 110 = Pause Break
  keycode 111 = Print Execute

When I run `xmodmap ~/.Xmodmap` Eclipse receives one MAPPING-NOTIFY
event for each line in the .Xmodmap file.  The 'keycode' in the .Xmodmap
file ends up in the START slot of the MAPPING-NOTIFY event.

Now, seeing as the DEFINE-KEYSYM function takes `name` and `value`, I
assume I should be able to do something like this:

  (define-keysym (keycode->keyname *display* (event-start event))



(defun define-keysym (name value)
  (pushnew name (gethash value *keysym->keyname* nil))
  (setf (gethash name *keyname->keysyms*) value))

(defun keysym->keyname (keysym)
  (car (last (gethash keysym *keysym->keyname*))))

(defun keyname->keysym (keyname)
  (gethash keyname *keyname->keysyms*))

(defun keyname->keycodes (disp keyname)
  (xlib:keysym->keycodes disp (keyname->keysym keyname)))

(defun keycode->keyname (disp keycode)
  (keysym->keyname (xlib:keycode->keysym disp keycode 0)))



More information about the eclipse-devel mailing list