README.xterm 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. Solving keyboard related problems
  2. with XTERM
  3. and GNU Midnight Commander
  4. (and other programs as well).
  5. Xterm brings a handful of problems with input keys and their translations.
  6. Some of these problems include xterm's failure to make a difference between
  7. shifted and not shifted function keys (many keyboards do not have more than
  8. 10 or 12 function keys, so it is useful to generate higher function keys (11
  9. - 20) by pressing Shift and function key - 10 (e.g. Shift+F3 is F13). Xterm
  10. also doesn't send Alt+character and Meta+character as something other than
  11. plain character. Also, home key does not work on most systems. And keypad
  12. operator characters (+, -, /, *) send different sequences than normal +, -,
  13. /, * (or sometimes do not send anything).
  14. Please note that if you want to use the Alt key on an XTerm, you have to
  15. make sure you use:
  16. XTerm*eightBitInput: false
  17. Otherwise, you will just get accented keys.
  18. Fortunately this can be solved, since xterm is written on top of the
  19. X Toolkit Intrinsics, which has a built-in feature of event translation
  20. tables that can be specified using X resources. This doesn't apply to rxvt,
  21. where the only solution to this problem would be patching rxvt's sources and
  22. recompiling. So from now on, we are speaking only about xterm (and its
  23. modifications, like color_xterm and ansi_xterm).
  24. Xterm brings two new Xt widgets (if you don't know what they are it doesn't
  25. matter), vt100 and tek4014 (these are used for the terminal display in vt100
  26. and tektronics mode). The translation table is specified in
  27. *vt100.translations and *tek4014.translations resources.
  28. You can see a sample in xterm.ad file in this directory.
  29. If you want to install these translations, bear in mind that you have to
  30. keep your terminfo and termcap in sync with these. So if you install
  31. xterm.ad, you have to install xterm.ti and xterm.tcap (or do necessary
  32. changes yourself).
  33. xterm.ad has to be loaded into the Xrm (X resource manager), either by xterm
  34. itself or by xrdb utility. There are many places you may want to install it
  35. to; the decision is yours. Preferably it should go to your personal
  36. $HOME/.Xdefaults file (if you have any). This file is automatically loaded
  37. using xrdb whenever you start the X server (it is done by startx and openwin
  38. scripts). Another possibility is to put this into
  39. $X11ROOT/lib/X11/app-defaults/XTerm or wherever your app-defaults file of
  40. xterm is and whatever is its name (sometimes it will have to be XTerm-ansi,
  41. XTerm-color etc.) Or you can put this anywhere and call
  42. xrdb xterm.ad
  43. from any script you run on X11 startup.
  44. xterm.ti (terminfo database source) is installed by running `tic xterm.ti'.
  45. tic will compile it and place it into your TERMINFO directory.
  46. xterm.tcap is the xterm (and xterm-color) termcap entry. It is based on the
  47. newest termcap database from http://www.ccil.org/~esr/ncurses.html, but
  48. contains a bunch of changes to make all the above mentioned keys work. Even
  49. if mc is compiled so that it uses terminfo, you need to install the termcap
  50. entry so that other programs which use termcap will behave correctly. You
  51. have to edit your /etc/termcap and replace xterm and xterm-color entries
  52. with those from xterm.tcap.
  53. The xterm.ad translation table contains many items (some of them may be
  54. unnecessary) but are included only to make it work on all different xterms
  55. (xterm terminfo and termcap databases have different sequences for the same
  56. keys in every different database, so xterm.ad works as a stardard to make
  57. xterm.ti and termcap happy). If you find that xterm works well even if you
  58. delete some lines from the translations, feel free to do it.
  59. By default, Alt+character keys received by mc are generated in xterm.ad by
  60. Alt modifier plus the key. On some systems, you may want to change this to
  61. the Meta modifier (e.g. if the Alt modifier is missing). You do it by
  62. replacing a letter s at the beginning of table lines with letter m.
  63. And what you might want to know, if you are going to change anything, is:
  64. Each line looks like
  65. modifiers<Key>keyname: string("something") \n\
  66. where modifiers can be:
  67. a for alt
  68. m for meta
  69. c for control
  70. button1 (2, 3) for mouse buttons.
  71. The string is generated whenever the named key is pressed while the
  72. modifiers are in a state matching the specification. Naming a modifier
  73. specifies that the modifier must be pressed. A ~ in front of a modifier
  74. name specifies that the modifier must NOT be pressed. If the set of
  75. modifiers is preceded by !, unmentioned modifiers must not be
  76. pressed; otherwise their state is ignored.
  77. After <Key> you specify a name of the key (if you don't know a canonical
  78. name of any key, see $X11ROOT/include/X11/keysymdef.h (keynames are the
  79. names there without leading XK_). Then there can be any sequence of string
  80. statements which send the string to the tty line, as if the user typed that
  81. sequence of characters. If it has the form string(0xXX), where X's are
  82. hexadecimal digits, then the ascii character of that value is sent rather
  83. than 0xXX.
  84. This is a subset of all the translation table features. If you want a
  85. complete reference, see xterm(1) and X Toolkit Intrinsics manual Appendix B.
  86. Please, if you find any problems or errors in this stuff, let me know by
  87. e-mail to
  88. mc-devel@gnome.org.