keymapping.txt revision a180a41bba1d50822df23fff0099e90b86638b89
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncKeyboard mapping
a180a41bba1d50822df23fff0099e90b86638b89vboxsync================
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncThis release of rdesktop uses a new, portable keyboard mapping
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncimplementation. It should hopefully work on all X11 systems. This new
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncimplementation only looks at X11 keysyms: Not on (nonportable)
a180a41bba1d50822df23fff0099e90b86638b89vboxsynckeycodes or modifier status. This means that rdesktop will obey your
a180a41bba1d50822df23fff0099e90b86638b89vboxsynclocal keyboard configuration. For example, if you have swapped
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncCapsLock and Control, rdesktop will use this mapping.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncXKB is currently not used. It seems like a good idea to me, but since
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncsome X servers (like Xvnc) does not support XKB, we still need to use
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncthe plain old interface as well, at least.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncThere are still some small problems.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync* CapsLock: CapsLock changes are never sent to the RDP
a180a41bba1d50822df23fff0099e90b86638b89vboxsync server. rdesktop does not know which keys that are modified by
a180a41bba1d50822df23fff0099e90b86638b89vboxsync CapsLock and which are not. So, the CapsLock indicator in Wordpad
a180a41bba1d50822df23fff0099e90b86638b89vboxsync etc will always be off.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncComposing/Multi_key is supported. For more information, see:
a180a41bba1d50822df23fff0099e90b86638b89vboxsync XFree86: /usr/X11R6/lib/X11/locale/*/Compose
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Solaris' Openwin: /usr/openwin/include/X11/Suncompose.h
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Irix6: compose(5)
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncKeymap files
a180a41bba1d50822df23fff0099e90b86638b89vboxsync============
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncThe names of the keymaps follows RFC1766.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync(You can find a translation from Windows keyboard layout numbers to
a180a41bba1d50822df23fff0099e90b86638b89vboxsynckeymap names by looking at
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncHKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\RFC1766 in the
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncContents of keymap files
a180a41bba1d50822df23fff0099e90b86638b89vboxsync========================
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncThe keymaps are line based. There are four different types of lines:
a180a41bba1d50822df23fff0099e90b86638b89vboxsync1) include lines
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncinclude <another-map-file>
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncinclude common
a180a41bba1d50822df23fff0099e90b86638b89vboxsync2) map lines
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncmap <hex-number>
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncMap-lines specifies how the remote RDP server should interpret the
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncsent scancodes.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync3) Translation lines
a180a41bba1d50822df23fff0099e90b86638b89vboxsync<keysym-name> <scancode> [flags..]
a180a41bba1d50822df23fff0099e90b86638b89vboxsynconehalf 0x29 shift
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncThe scancode can be found in scancodes.h. Note: The scancode value for
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncextended keys can be calculated by OR:ing with 0x80. Example: The
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncDelete key have the scancode sequence 0xe0, 0x52. You can get the
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncscancode value to put into the map file by running:
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncpython -c "print hex(0x80 | 0x52)"
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncIf flags are "altgr", "shift", the scancode sent for this keysym will
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncbe prefixed with AltGr, or Shift.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncIf flags includes "addupper", a translation for this keysyms uppercase
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncname will be added as well, in addition to the non-uppercase
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncname. Example:
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncx 2d addupper
a180a41bba1d50822df23fff0099e90b86638b89vboxsync...will add an translation for "X" automatically, just like if you
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncwould specify:
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncIf flags include "localstate", the modifier to send will be determined
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncby the local modifier state.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncIf flags is "inhibit", nothing will be sent to the server.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncIf flags is "numlock", rdesktop will make sure that the remote NumLock
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstate is on before generating the key event. Otherwise, it will make
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncsure NumLock is off.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync4) enable_compose
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncIf any line starts with the keyword "enable_compose", rdesktop will
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncenable local Compose/Multi_key handling. Enabling this will often make
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncit impossible to compose characters with dead keys (on the remote
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncside). This is because when local compose support is enabled, dead
a180a41bba1d50822df23fff0099e90b86638b89vboxsynckeys will not be sent to the remote side.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync5) sequence lines
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncsequence <event-keysym-name> <keysym-name1> <keysym-name2> ...
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncsequence eacute dead_acute e
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncsequence F12 f o o at e x a m p l e period c o m
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncSequence lines allows you to specify that multiple scancodes should be
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncsent to the RDP server, in response to one X11 keyboard event. Note:
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncThe sequence is sent at the X11 KeyPress event. Nothing is sent at
a180a41bba1d50822df23fff0099e90b86638b89vboxsync6) keyboard_type lines
a180a41bba1d50822df23fff0099e90b86638b89vboxsynckeyboard_type <hex-number>
a180a41bba1d50822df23fff0099e90b86638b89vboxsynckeyboard_type lines specifies the keyboard type. Default value is 0x4
a180a41bba1d50822df23fff0099e90b86638b89vboxsync(en-us 101/104 keys keyboard).
a180a41bba1d50822df23fff0099e90b86638b89vboxsync7) keyboard_subtype lines
a180a41bba1d50822df23fff0099e90b86638b89vboxsynckeyboard_subtype <hex-number>
a180a41bba1d50822df23fff0099e90b86638b89vboxsynckeyboard_subtype lines specifies the keyboard subtype. Default value
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncis 0x0 (en-us 101/104 keys keyboard).
a180a41bba1d50822df23fff0099e90b86638b89vboxsync8) keyboard_functionkeys lines
a180a41bba1d50822df23fff0099e90b86638b89vboxsynckeyboard_functionkeys <hex-number>
a180a41bba1d50822df23fff0099e90b86638b89vboxsynckeyboard_functionkeys specifies the number of keyboard function
a180a41bba1d50822df23fff0099e90b86638b89vboxsynckeys. Default value is 0xc (12, for standard 101/104 keys keyboard).
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncSuggested X11 keysym mapping on PCs
a180a41bba1d50822df23fff0099e90b86638b89vboxsync===================================
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncUnfortunately, there is no standard for which keysyms a given key
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncshould generate. If you have a PC-keyboard with Windows keys, I suggest this mapping:
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncKeyboard keys:
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncCtrlLeft WinLeft AltLeft Space AltGr WinRight Menu CtrlRight
a180a41bba1d50822df23fff0099e90b86638b89vboxsync...should generate keysyms:
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncControl_L Super_L Alt_L space Mode_switch Super_R Menu Control_R
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncAdditionally:
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncShift-Alt should produce Meta_L
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncShift-AltGr should produce Multi_Key.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncUse a modifier-map like this:
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncshift Shift_L (0x32), Shift_R (0x3e)
a180a41bba1d50822df23fff0099e90b86638b89vboxsynclock Caps_Lock (0x25)
a180a41bba1d50822df23fff0099e90b86638b89vboxsynccontrol Control_L (0x42), Control_R (0x6d)
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncmod1 Alt_L (0x40)
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncmod2 Num_Lock (0x4d)
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncmod3 Mode_switch (0x71)
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncmod4 Super_L (0x73), Super_R (0x74)
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncmod5 Scroll_Lock (0x4e)
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncUpdating / writing keymap files
a180a41bba1d50822df23fff0099e90b86638b89vboxsync===============================
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncWhen writing new or updating keymap files, please use comments and
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncblanks, to increase readability. The "sv" keymap is a good template.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncWhen you need to add a translation to a keymap file, do:
a180a41bba1d50822df23fff0099e90b86638b89vboxsync 1. Get the "key number" for this key, by looking at keynums.png.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync 2. Take a look at scancodes.h, and look for
a180a41bba1d50822df23fff0099e90b86638b89vboxsync SCANCODE_KEY_<my-key-number>. The scancode value is at the end of
a180a41bba1d50822df23fff0099e90b86638b89vboxsync the line. If the line contains (SCANCODE_EXTENDED | 0xsomething),
a180a41bba1d50822df23fff0099e90b86638b89vboxsync then you should OR 0x80 to this value. For example, you can do:
a180a41bba1d50822df23fff0099e90b86638b89vboxsync python -c "print hex(0x80 | 0xsomething)"
a180a41bba1d50822df23fff0099e90b86638b89vboxsync 3. Put the scancode (from step 2) and keysym name (found in the
a180a41bba1d50822df23fff0099e90b86638b89vboxsync error message) into the keymap file.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncSpecial keys
a180a41bba1d50822df23fff0099e90b86638b89vboxsync============
a180a41bba1d50822df23fff0099e90b86638b89vboxsync* The combination Ctrl-Alt-Enter toggles between fullscreen and
a180a41bba1d50822df23fff0099e90b86638b89vboxsync non-fullscreen mode.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync* Meta, Hyper and Super are treated as windows keys. RDP4 does not
a180a41bba1d50822df23fff0099e90b86638b89vboxsync support the windows keys though, so if you are running RDP4, these
a180a41bba1d50822df23fff0099e90b86638b89vboxsync keys will translate to Ctrl-Esc.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncWhen changing the keyboard code, make sure all these tests in Notepad
a180a41bba1d50822df23fff0099e90b86638b89vboxsync1. Ctrl+f should bring up Find dialog, with CapsLock both on and off.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync2. Ctrl+Shift+arrows should mark text, with CapsLock both on and off.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync3. Test a sequence, like egrave. If you don't have this symbol in your
a180a41bba1d50822df23fff0099e90b86638b89vboxsync keyboard layout, try something like:
a180a41bba1d50822df23fff0099e90b86638b89vboxsync xmodmap -e "keycode 49 = egrave"
a180a41bba1d50822df23fff0099e90b86638b89vboxsync4. Test a char generated with AltGr, such as @ on a swedish keyboard.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync5. Test Ctrl-Alt-Delete.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync6. Ctrl-Alt-Enter should toggle fullscreen.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync7. Test NumLock synchronization using the -N option. Excel is able to
a180a41bba1d50822df23fff0099e90b86638b89vboxsync indicate the current NumLock state. Verify that the status is
a180a41bba1d50822df23fff0099e90b86638b89vboxsync updated correctly on reconnects.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync8. Test the Windows keys, standalone as well as in combination with,
a180a41bba1d50822df23fff0099e90b86638b89vboxsync9. Make sure the system menu (via Alt-space) cannot be accessed in
a180a41bba1d50822df23fff0099e90b86638b89vboxsync single app mode.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync10. Make sure keymaps can be loaded from ~/.rdesktop/keymaps,
a180a41bba1d50822df23fff0099e90b86638b89vboxsync KEYMAP_PATH, $CWD/keymaps, and from an absolute path.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync11. Press Shift, then press a key modified by shift, the release
a180a41bba1d50822df23fff0099e90b86638b89vboxsync shift, then release the other key. Do this in a speedy fasion.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Make sure the shift state is not stuck down.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync12. Test all numpad keys, when not using the -N option.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync13. Map a single, un-shifted key (such as F1) to XK_A:
a180a41bba1d50822df23fff0099e90b86638b89vboxsync xmodmap -e "keycode 67 = A A"
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Perform in Notepad:
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Write some text
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Release b
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Release F1
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Verify that shift is not stuck down, by clicking on the text.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync14. Use a keyboard layout where Meta_L can be generated with Shift_R +
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Alt_L. Then:
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Start Notepad
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Press Shift_R
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Press Alt_L
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Release Shift_R
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Release Alt_L
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Press "e"
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Verify that you get an "e" in Notepad, rather than start Windows