more keyboard stuff. We're nearly done.

svn path=/trunk/kdebase/konsole/; revision=39727
wilder-portage
Lars Doelle 26 years ago
parent ca3c0b1aa8
commit 95c8e01a4a
  1. 129
      include/default.keytab.h
  2. 2
      other/Makefile.am
  3. 129
      other/default.Keytab
  4. 23
      other/linux.keytab
  5. 27
      other/vt100.keytab
  6. 21
      src/TEmuVt102.C
  7. 2
      src/keytrans.C

@ -1,131 +1,78 @@
/* generated by '../tests/quote ../other/default.Keytab' */
"# [KeyTab] Konsole Keyboard Table\n"
"#\n"
"# --------------------------------------------------------------\n"
"\n"
"hdr \"xterm\"\n"
"keyboard \"default\"\n"
"\n"
"# --------------------------------------------------------------\n"
"#\n"
"# This configuration table allows to customize the\n"
"# meaning of the keys.\n"
"#\n"
"# The syntax is that each entry has the form : \n"
"# The syntax of each entry has the form \n"
"#\n"
"# \"key\" Keyname { (\"+\"|\"-\") Modename } \":\" (String|Operation)\n"
"#\n"
"# Keynames are those defined in <qnamespace.h> with the\n"
"# \"Qt::Key_\" removed. (We'd better insert the list here)\n"
"#\n"
"# Mode names are : \n"
"#\n"
"# - Shift\n"
"# - Alt\n"
"# - Control\n"
"#\n"
"# The VT100 emulation has two modes that can affect the\n"
"# sequences emitted by certain keys. These modes are\n"
"# under control of the client program.\n"
"# \n"
"# - Newline : effects Return and Enter key.\n"
"# - Application : effects Up and Down key.\n"
"# - Ansi : effects Up and Down key.\n"
"#\n"
"# Operations are\n"
"#\n"
"# - scrollUpLine\n"
"# - scrollUpPage\n"
"# - scrollDownLine\n"
"# - scrollDownPage\n"
"#\n"
"# - emitSelection\n"
"# Mode names are: Shift, Alt, Control.\n"
"#\n"
"# If the key is not found here, the text of the\n"
"# key event as provided by QT is emitted, possibly\n"
"# preceeded by ESC if the Alt key is pressed.\n"
"#\n"
"# --------------------------------------------------------------\n"
"#\n"
"# Note that this table is a \"risc\" version made to ease\n"
"# customization without bothering with obsolete details.\n"
"# See VT100.keytab for more hairy stuff.\n"
"#\n"
"# --------------------------------------------------------------\n"
"\n"
"key Escape : \"\\E\"\n"
"key Tab : \"\\t\"\n"
"\n"
"# VT100 can add an extra \\n after return.\n"
"# The NewLine mode is set by an escape sequence.\n"
"\n"
"key Return-Alt-NewLine : \"\\r\" \n"
"key Return-Alt+NewLine : \"\\r\\n\"\n"
"key Escape : \"\\E\"\n"
"key Tab : \"\\t\"\n"
"\n"
"key Return+Alt-NewLine : \"\\E\\r\" \n"
"key Return+Alt+NewLine : \"\\E\\r\\n\"\n"
"key Enter : \"\\r\" # Keypad-Enter.\n"
"key Return-Alt : \"\\r\" \n"
"key Return+Alt : \"\\E\\r\" \n"
"\n"
"# Note that Backspace and Delete are sending\n"
"# other codes but the expected.\n"
"# Backspace and Delete are sending codes preserving CTRL-H.\n"
"\n"
"key Backspace : \"\\x7f\"\n"
"key Delete : \"\\E[3~\"\n"
"\n"
"# These codes are for the VT52 mode of VT100\n"
"# The Ansi mode (i.e. VT100 mode) is set by\n"
"# an escape sequence\n"
"\n"
"key Up -Shift-Ansi : \"\\EA\"\n"
"key Down -Shift-Ansi : \"\\EB\"\n"
"key Right-Ansi : \"\\EC\"\n"
"key Left -Ansi : \"\\ED\"\n"
"\n"
"# VT100 emits a mode bit together\n"
"# with the arrow keys.The AppCuKeys\n"
"# mode is set by an escape sequence.\n"
"\n"
"key Up -Shift+Ansi+AppCuKeys : \"\\EOA\"\n"
"key Down -Shift+Ansi+AppCuKeys : \"\\EOB\"\n"
"key Right+Ansi+AppCuKeys : \"\\EOC\"\n"
"key Left +Ansi+AppCuKeys : \"\\EOD\"\n"
"\n"
"key Up -Shift+Ansi-AppCuKeys : \"\\E[A\"\n"
"key Down -Shift+Ansi-AppCuKeys : \"\\E[B\"\n"
"key Right+Ansi-AppCuKeys : \"\\E[C\"\n"
"key Left +Ansi-AppCuKeys : \"\\E[D\"\n"
"\n"
"# linux functions keys F1-F5 differ from xterm\n"
"#\n"
"# F1 : \"\\E[[A\" \n"
"# F2 : \"\\E[[B\" \n"
"# F3 : \"\\E[[C\" \n"
"# F4 : \"\\E[[D\" \n"
"# F5 : \"\\E[[E\" \n"
"\n"
"# function keys\n"
"\n"
"key F1 : \"\\E[11~\"\n"
"key F2 : \"\\E[12~\"\n"
"key F3 : \"\\E[13~\"\n"
"key F4 : \"\\E[14~\"\n"
"key F5 : \"\\E[15~\"\n"
"key F6 : \"\\E[17~\" \n"
"key F7 : \"\\E[18~\" \n"
"key F8 : \"\\E[19~\" \n"
"key F9 : \"\\E[20~\" \n"
"key F10 : \"\\E[21~\" \n"
"key F11 : \"\\E[23~\" \n"
"key F12 : \"\\E[24~\" \n"
"\n"
"key Home : \"\\E[1~\" \n"
"key End : \"\\E[4~\" \n"
"\n"
"key F1 : \"\\E[11~\"\n"
"key F2 : \"\\E[12~\"\n"
"key F3 : \"\\E[13~\"\n"
"key F4 : \"\\E[14~\"\n"
"key F5 : \"\\E[15~\"\n"
"key F6 : \"\\E[17~\" \n"
"key F7 : \"\\E[18~\" \n"
"key F8 : \"\\E[19~\" \n"
"key F9 : \"\\E[20~\" \n"
"key F10 : \"\\E[21~\" \n"
"key F11 : \"\\E[23~\" \n"
"key F12 : \"\\E[24~\" \n"
"\n"
"key Up -Shift : \"\\EOA\"\n"
"key Down -Shift : \"\\EOB\"\n"
"key Right : \"\\EOC\"\n"
"key Left : \"\\EOD\"\n"
"\n"
"key Home : \"\\E[1~\" \n"
"key End : \"\\E[4~\" \n"
"key Prior -Shift : \"\\E[5~\" \n"
"key Next -Shift : \"\\E[6~\" \n"
"key Insert-Shift : \"\\E[2~\" \n"
"\n"
"# Keypad-Enter. See comment on Return above.\n"
"\n"
"key Enter+NewLine : \"\\r\\n\"\n"
"key Enter-NewLine : \"\\r\" \n"
"# Work around dead keys\n"
"\n"
"key Space +Control : \"\\x00\"\n"
"\n"
"# some of keys are used by konsole.\n"
"# Some keys are used by konsole to cause operations.\n"
"\n"
"key Up +Shift : scrollLineUp\n"
"key Prior +Shift : scrollPageUp\n"
@ -139,6 +86,6 @@
"# cannot be recognized as such.\n"
"\n"
"#----------------------------------------------------------\n"
"\n"
"# \n"
"# Following other strings as emitted by konsole.\n"
""

@ -6,7 +6,7 @@ data_DATA = BlackOnLightYellow.schema BlackOnWhite.schema \
DarkPicture.schema LightPicture.schema Transparent.schema GreenTint.schema \
Transparent_MC.schema GreenTint_MC.schema \
linux.desktop mc.desktop shell.desktop su.desktop \
linux.keytab nobshack.keytab
linux.keytab vt100.keytab
KDE_ICON = konsole

@ -1,129 +1,76 @@
# [KeyTab] Konsole Keyboard Table
#
# --------------------------------------------------------------
hdr "xterm"
keyboard "default"
# --------------------------------------------------------------
#
# This configuration table allows to customize the
# meaning of the keys.
#
# The syntax is that each entry has the form :
# The syntax of each entry has the form
#
# "key" Keyname { ("+"|"-") Modename } ":" (String|Operation)
#
# Keynames are those defined in <qnamespace.h> with the
# "Qt::Key_" removed. (We'd better insert the list here)
#
# Mode names are :
#
# - Shift
# - Alt
# - Control
#
# The VT100 emulation has two modes that can affect the
# sequences emitted by certain keys. These modes are
# under control of the client program.
#
# - Newline : effects Return and Enter key.
# - Application : effects Up and Down key.
# - Ansi : effects Up and Down key.
#
# Operations are
#
# - scrollUpLine
# - scrollUpPage
# - scrollDownLine
# - scrollDownPage
#
# - emitSelection
# Mode names are: Shift, Alt, Control.
#
# If the key is not found here, the text of the
# key event as provided by QT is emitted, possibly
# preceeded by ESC if the Alt key is pressed.
#
# --------------------------------------------------------------
#
# Note that this table is a "risc" version made to ease
# customization without bothering with obsolete details.
# See VT100.keytab for more hairy stuff.
#
# --------------------------------------------------------------
key Escape : "\E"
key Tab : "\t"
# VT100 can add an extra \n after return.
# The NewLine mode is set by an escape sequence.
key Return-Alt-NewLine : "\r"
key Return-Alt+NewLine : "\r\n"
key Escape : "\E"
key Tab : "\t"
key Return+Alt-NewLine : "\E\r"
key Return+Alt+NewLine : "\E\r\n"
key Enter : "\r" # Keypad-Enter.
key Return-Alt : "\r"
key Return+Alt : "\E\r"
# Note that Backspace and Delete are sending
# other codes but the expected.
# Backspace and Delete codes are preserving CTRL-H.
key Backspace : "\x7f"
key Delete : "\E[3~"
# These codes are for the VT52 mode of VT100
# The Ansi mode (i.e. VT100 mode) is set by
# an escape sequence
key Up -Shift-Ansi : "\EA"
key Down -Shift-Ansi : "\EB"
key Right-Ansi : "\EC"
key Left -Ansi : "\ED"
# VT100 emits a mode bit together
# with the arrow keys.The AppCuKeys
# mode is set by an escape sequence.
key Up -Shift+Ansi+AppCuKeys : "\EOA"
key Down -Shift+Ansi+AppCuKeys : "\EOB"
key Right+Ansi+AppCuKeys : "\EOC"
key Left +Ansi+AppCuKeys : "\EOD"
key Up -Shift+Ansi-AppCuKeys : "\E[A"
key Down -Shift+Ansi-AppCuKeys : "\E[B"
key Right+Ansi-AppCuKeys : "\E[C"
key Left +Ansi-AppCuKeys : "\E[D"
# linux functions keys F1-F5 differ from xterm
#
# F1 : "\E[[A"
# F2 : "\E[[B"
# F3 : "\E[[C"
# F4 : "\E[[D"
# F5 : "\E[[E"
# function keys
key F1 : "\E[11~"
key F2 : "\E[12~"
key F3 : "\E[13~"
key F4 : "\E[14~"
key F5 : "\E[15~"
key F6 : "\E[17~"
key F7 : "\E[18~"
key F8 : "\E[19~"
key F9 : "\E[20~"
key F10 : "\E[21~"
key F11 : "\E[23~"
key F12 : "\E[24~"
key Home : "\E[1~"
key End : "\E[4~"
key F1 : "\E[11~"
key F2 : "\E[12~"
key F3 : "\E[13~"
key F4 : "\E[14~"
key F5 : "\E[15~"
key F6 : "\E[17~"
key F7 : "\E[18~"
key F8 : "\E[19~"
key F9 : "\E[20~"
key F10 : "\E[21~"
key F11 : "\E[23~"
key F12 : "\E[24~"
key Up -Shift : "\EOA"
key Down -Shift : "\EOB"
key Right : "\EOC"
key Left : "\EOD"
key Home : "\E[1~"
key End : "\E[4~"
key Prior -Shift : "\E[5~"
key Next -Shift : "\E[6~"
key Insert-Shift : "\E[2~"
# Keypad-Enter. See comment on Return above.
key Enter+NewLine : "\r\n"
key Enter-NewLine : "\r"
# Work around dead keys
key Space +Control : "\x00"
# some of keys are used by konsole.
# Some keys are used by konsole to cause operations.
key Up +Shift : scrollLineUp
key Prior +Shift : scrollPageUp
@ -137,5 +84,5 @@ key Insert+Shift : emitSelection
# cannot be recognized as such.
#----------------------------------------------------------
#
# Following other strings as emitted by konsole.

@ -2,7 +2,7 @@
#
# --------------------------------------------------------------
hdr "(NOT FUNCTIONAL, YET) Linux"
keyboard "(NOT FUNCTIONAL, YET) linux"
# --------------------------------------------------------------
#
@ -28,7 +28,8 @@ hdr "(NOT FUNCTIONAL, YET) Linux"
#
# - Newline : effects Return and Enter key.
# - Application : effects Up and Down key.
# - Ansi : effects Up and Down key.
#
# - Ansi : effects Up and Down key (This is for VT52, really).
#
# Operations are
#
@ -87,19 +88,11 @@ key Left +Ansi-AppCuKeys : "\E[D"
# linux functions keys F1-F5 differ from xterm
F1 : "\E[[A"
F2 : "\E[[B"
F3 : "\E[[C"
F4 : "\E[[D"
F5 : "\E[[E"
# function keys
# key F1 : "\E[11~"
# key F2 : "\E[12~"
# key F3 : "\E[13~"
# key F4 : "\E[14~"
# key F5 : "\E[15~"
key F1 : "\E[[A"
key F2 : "\E[[B"
key F3 : "\E[[C"
key F4 : "\E[[D"
key F5 : "\E[[E"
key F6 : "\E[17~"
key F7 : "\E[18~"

@ -2,7 +2,7 @@
#
# --------------------------------------------------------------
hdr "(NOT FUNCTIONAL, YET) BS sends BS"
keyboard "(NOT FUNCTIONAL, YET) vt100"
# --------------------------------------------------------------
#
@ -28,7 +28,8 @@ hdr "(NOT FUNCTIONAL, YET) BS sends BS"
#
# - Newline : effects Return and Enter key.
# - Application : effects Up and Down key.
# - Ansi : effects Up and Down key.
#
# - Ansi : effects Up and Down key (This is for VT52, really).
#
# Operations are
#
@ -57,11 +58,10 @@ key Return-Alt+NewLine : "\r\n"
key Return+Alt-NewLine : "\E\r"
key Return+Alt+NewLine : "\E\r\n"
# Regular Backspace and Delete codes.
# This might not work on *ix systems.
# Some desperately try to save the ^H.
key Backspace : "\x08"
key Delete : "\x7f"
key Backspace : "\x7f"
key Delete : "\E[3~"
# These codes are for the VT52 mode of VT100
# The Ansi mode (i.e. VT100 mode) is set by
@ -86,21 +86,14 @@ key Down -Shift+Ansi-AppCuKeys : "\E[B"
key Right+Ansi-AppCuKeys : "\E[C"
key Left +Ansi-AppCuKeys : "\E[D"
# linux functions keys F1-F5 differ from xterm
#
# F1 : "\E[[A"
# F2 : "\E[[B"
# F3 : "\E[[C"
# F4 : "\E[[D"
# F5 : "\E[[E"
# function keys
# function keys (FIXME: make pf1-pf4)
key F1 : "\E[11~"
key F2 : "\E[12~"
key F3 : "\E[13~"
key F4 : "\E[14~"
key F5 : "\E[15~"
key F6 : "\E[17~"
key F7 : "\E[18~"
key F8 : "\E[19~"
@ -109,8 +102,8 @@ key F10 : "\E[21~"
key F11 : "\E[23~"
key F12 : "\E[24~"
key Home : "\E[1~"
key End : "\E[4~"
key Home : "\E[H"
key End : "\E[F"
key Prior -Shift : "\E[5~"
key Next -Shift : "\E[6~"

@ -738,12 +738,15 @@ void TEmuVt102::onKeyPress( QKeyEvent* ev )
//printf("State/Key: 0x%04x 0x%04x (%d,%d)\n",ev->state(),ev->key(),ev->text().length(),ev->text().length()?ev->text().ascii()[0]:0);
/*NO! this is correct X-On/X-Off behavior, i think. Use Ctrl-Q to release.
If this is not the problem, it needs to be fixed in TEPty.C, but i doubt.
if ((ev->key()==Key_S) && (ev->state()==ControlButton))
return; // Ctrl+s will cause it to freeze up
// (this is a tty problem, possibly)
// It's something to do with "ctrl+s"
// toggling Scroll on the [real] console
// This is a hack, but it works. So there.
*/
// revert to non-history when typing
if (scr->getHistCursor() != scr->getHistLines());
@ -751,10 +754,9 @@ void TEmuVt102::onKeyPress( QKeyEvent* ev )
// lookup in keyboard translation table ...
int cmd; const char* txt; int len;
if (keytrans->findEntry(ev->key(), encodeMode(MODE_NewLine , BITS_NewLine ) +
encodeMode(MODE_BsHack , BITS_BsHack ) + //FIXME: deprecated
encodeMode(MODE_Ansi , BITS_Ansi ) +
encodeMode(MODE_AppCuKeys, BITS_AppCuKeys ) +
if (keytrans->findEntry(ev->key(), encodeMode(MODE_NewLine , BITS_NewLine ) + // OLD,
encodeMode(MODE_Ansi , BITS_Ansi ) + // OBSOLETE,
encodeMode(MODE_AppCuKeys, BITS_AppCuKeys ) + // VT100 stuff
encodeStat(ControlButton , BITS_Control ) +
encodeStat(ShiftButton , BITS_Shift ) +
encodeStat(AltButton , BITS_Alt ),
@ -818,7 +820,7 @@ static unsigned short vt100_graphics[32] =
unsigned short TEmuVt102::applyCharset(unsigned short c)
{
if (CHARSET.graphic && 0x5f <= c && c <= 0x7e) return vt100_graphics[c-0x5f];
if (CHARSET.pound && c == '#' ) return 0xa3;
if (CHARSET.pound && c == '#' ) return 0xa3; //This mode is obsolete
return c;
}
@ -883,7 +885,7 @@ void TEmuVt102::useCharset(int n)
{
CHARSET.cu_cs = n&3;
CHARSET.graphic = (CHARSET.charset[n&3] == '0');
CHARSET.pound = (CHARSET.charset[n&3] == 'A');
CHARSET.pound = (CHARSET.charset[n&3] == 'A'); //This mode is obsolete
}
/*! Save the cursor position and the rendition attribute settings. */
@ -891,7 +893,7 @@ void TEmuVt102::useCharset(int n)
void TEmuVt102::saveCursor()
{
CHARSET.sa_graphic = CHARSET.graphic;
CHARSET.sa_pound = CHARSET.pound;
CHARSET.sa_pound = CHARSET.pound; //This mode is obsolete
// we are not clear about these
//sa_charset = charsets[cScreen->charset];
//sa_charset_num = cScreen->charset;
@ -903,7 +905,7 @@ void TEmuVt102::saveCursor()
void TEmuVt102::restoreCursor()
{
CHARSET.graphic = CHARSET.sa_graphic;
CHARSET.pound = CHARSET.sa_pound;
CHARSET.pound = CHARSET.sa_pound; //This mode is obsolete
scr->restoreCursor();
}
@ -912,8 +914,9 @@ void TEmuVt102::restoreCursor()
void TEmuVt102::resetModes()
{
resetMode(MODE_Mouse1000); saveMode(MODE_Mouse1000);
resetMode(MODE_AppCuKeys); saveMode(MODE_AppCuKeys);
resetMode(MODE_AppScreen); saveMode(MODE_AppScreen);
// here come obsolete modes
resetMode(MODE_AppCuKeys); saveMode(MODE_AppCuKeys);
resetMode(MODE_NewLine );
setMode(MODE_Ansi );
resetMode(MODE_BsHack );

@ -278,7 +278,7 @@ KeyTrans* KeyTrans::fromDevice(QString path, QIODevice &buf)
// Test tokenizer
Loop:
// syntax: ["key" KeyName { ("+" | "-") ModeName } ":" String/CommandName] ["#" Comment]
if (sym == SYMName && !strcmp(res.ascii(),"hdr"))
if (sym == SYMName && !strcmp(res.ascii(),"keyboard"))
{
getSymbol(buf);
if (sym != SYMString) goto ERROR; // header expected

Loading…
Cancel
Save