Fixed support for handling Meta key as Alt key in terminal emulation.

This resolves bug 1026.
pull/2/head
Michele Calgaro 11 years ago
parent c5a0a7cec0
commit cb77022865

@ -948,19 +948,17 @@ void TEmuVt102::onKeyPress( TQKeyEvent* ev )
encodeStat(TQt::AltButton , BITS_Alt ); encodeStat(TQt::AltButton , BITS_Alt );
if (metaKeyMode) if (metaKeyMode)
bits += encodeStat(TQt::MetaButton , BITS_Alt); bits += encodeStat(TQt::MetaButton , BITS_Alt);
bool transRes = keytrans->findEntry(ev->key(), bits, &cmd, &txt, &len, &metaspecified); keytrans->findEntry(ev->key(), bits, &cmd, &txt, &len, &metaspecified);
//if (transRes)
// printf("cmd: %d, %s, %d\n",cmd,txt,len);
if (connected) if (connected)
{ {
switch(cmd) // ... and execute if found. switch(cmd) // ... and execute if found.
{ {
case CMD_scrollPageUp : gui->doScroll(-gui->Lines()/2); return; case CMD_scrollPageUp : gui->doScroll(-gui->Lines()/2); return;
case CMD_scrollPageDown : gui->doScroll(+gui->Lines()/2); return; case CMD_scrollPageDown : gui->doScroll(+gui->Lines()/2); return;
case CMD_scrollLineUp : gui->doScroll(-1 ); return; case CMD_scrollLineUp : gui->doScroll(-1 ); return;
case CMD_scrollLineDown : gui->doScroll(+1 ); return; case CMD_scrollLineDown : gui->doScroll(+1 ); return;
case CMD_scrollLock : onScrollLock( ); return; case CMD_scrollLock : onScrollLock( ); return;
} }
} }
if (holdScreen) if (holdScreen)
{ {
@ -990,7 +988,8 @@ void TEmuVt102::onKeyPress( TQKeyEvent* ev )
// fall back handling // fall back handling
if (!ev->text().isEmpty()) if (!ev->text().isEmpty())
{ {
if (ev->state() & TQt::AltButton) sendString("\033"); // ESC, this is the ALT prefix if ((ev->state() & TQt::AltButton) || (metaKeyMode && (ev->state() & TQt::MetaButton)))
sendString("\033"); // ESC, this is the ALT prefix
TQCString s = m_codec->fromUnicode(ev->text()); // encode for application TQCString s = m_codec->fromUnicode(ev->text()); // encode for application
// FIXME: In Qt 2, TQKeyEvent::text() would return "\003" for Ctrl-C etc. // FIXME: In Qt 2, TQKeyEvent::text() would return "\003" for Ctrl-C etc.
// while in Qt 3 it returns the actual key ("c" or "C") which caused // while in Qt 3 it returns the actual key ("c" or "C") which caused

Loading…
Cancel
Save