summaryrefslogtreecommitdiffstats
path: root/konsole
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2014-04-19 23:19:49 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2014-04-19 23:19:49 +0900
commitc7a9fafe524bdb6549860057d3ecd92f4c931a4d (patch)
treed108405d91269a89c16883114f6fdefce56262ed /konsole
parent1e170d411c6679af09864192b3d8354c7385d7cf (diff)
downloadtdebase-c7a9fafe524bdb6549860057d3ecd92f4c931a4d.tar.gz
tdebase-c7a9fafe524bdb6549860057d3ecd92f4c931a4d.zip
Added support for handling Meta key as Alt key in terminal emulation.
This relates to bug 1026.
Diffstat (limited to 'konsole')
-rw-r--r--konsole/konsole/TEmuVt102.cpp29
-rw-r--r--konsole/konsole/TEmulation.cpp1
-rw-r--r--konsole/konsole/TEmulation.h2
3 files changed, 20 insertions, 12 deletions
diff --git a/konsole/konsole/TEmuVt102.cpp b/konsole/konsole/TEmuVt102.cpp
index c460693c..ebe090fd 100644
--- a/konsole/konsole/TEmuVt102.cpp
+++ b/konsole/konsole/TEmuVt102.cpp
@@ -936,18 +936,21 @@ void TEmuVt102::onKeyPress( TQKeyEvent* ev )
// lookup in keyboard translation table ...
int cmd = CMD_none;
- const char* txt;
+ const char *txt;
int len;
bool metaspecified;
- if (keytrans->findEntry(ev->key(), encodeMode(MODE_NewLine , BITS_NewLine ) + // OLD,
- encodeMode(MODE_Ansi , BITS_Ansi ) + // OBSOLETE,
- encodeMode(MODE_AppCuKeys , BITS_AppCuKeys ) + // VT100 stuff
- encodeMode(MODE_AppScreen , BITS_AppScreen ) + // VT100 stuff
- encodeStat(TQt::ControlButton , BITS_Control ) +
- encodeStat(TQt::ShiftButton , BITS_Shift ) +
- encodeStat(TQt::AltButton , BITS_Alt ),
- &cmd, &txt, &len, &metaspecified ))
-//printf("cmd: %d, %s, %d\n",cmd,txt,len);
+ int bits = encodeMode(MODE_NewLine , BITS_NewLine ) + // OLD,
+ encodeMode(MODE_Ansi , BITS_Ansi ) + // OBSOLETE,
+ encodeMode(MODE_AppCuKeys , BITS_AppCuKeys ) + // VT100 stuff
+ encodeMode(MODE_AppScreen , BITS_AppScreen ) + // VT100 stuff
+ encodeStat(TQt::ControlButton, BITS_Control ) +
+ encodeStat(TQt::ShiftButton , BITS_Shift ) +
+ encodeStat(TQt::AltButton , BITS_Alt );
+ if (metaKeyMode)
+ bits += encodeStat(TQt::MetaButton , BITS_Alt);
+ bool transRes = keytrans->findEntry(ev->key(), bits, &cmd, &txt, &len, &metaspecified);
+//if (transRes)
+// printf("cmd: %d, %s, %d\n",cmd,txt,len);
if (connected)
{
switch(cmd) // ... and execute if found.
@@ -976,8 +979,10 @@ void TEmuVt102::onKeyPress( TQKeyEvent* ev )
|| ev->key()==Qt::Key_PageUp || ev->key()==Qt::Key_PageDown))
scr->setHistCursor(scr->getHistLines());
- if (cmd==CMD_send) {
- if ((ev->state() & TQt::AltButton) && !metaspecified ) sendString("\033");
+ if (cmd==CMD_send)
+ {
+ if (((ev->state() & TQt::AltButton) || (metaKeyMode && (ev->state() & TQt::MetaButton))) && !metaspecified)
+ sendString("\033");
emit sndBlock(txt,len);
return;
}
diff --git a/konsole/konsole/TEmulation.cpp b/konsole/konsole/TEmulation.cpp
index 939139d0..3aa1cfad 100644
--- a/konsole/konsole/TEmulation.cpp
+++ b/konsole/konsole/TEmulation.cpp
@@ -98,6 +98,7 @@ TEmulation::TEmulation(TEWidget* w)
scr(0),
connected(false),
listenToKeyPress(false),
+ metaKeyMode(false),
m_codec(0),
decoder(0),
keytrans(0),
diff --git a/konsole/konsole/TEmulation.h b/konsole/konsole/TEmulation.h
index a5f43217..6eac5f91 100644
--- a/konsole/konsole/TEmulation.h
+++ b/konsole/konsole/TEmulation.h
@@ -89,6 +89,7 @@ public:
virtual void setMode (int) = 0;
virtual void resetMode(int) = 0;
+ void setMetaKeyMode(bool mode) { metaKeyMode = mode; }
virtual void sendString(const char*) = 0;
@@ -119,6 +120,7 @@ protected:
bool connected; // communicate with widget
bool listenToKeyPress; // listen to input
+ bool metaKeyMode; // true -> meta key is handled as Alt
void setCodec(int c); // codec number, 0 = locale, 1=utf8