diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2014-05-16 18:32:17 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2014-05-16 18:32:17 +0900 |
commit | efdf0bbcd37d5aaa05649437b286aeecfd38c617 (patch) | |
tree | f056c88a705748c6b871fe4ba6f4e103bb37d822 | |
parent | 83708272fbd48b9a65342cc66af5c0a3837d7a13 (diff) | |
download | tdebase-efdf0bbcd37d5aaa05649437b286aeecfd38c617.tar.gz tdebase-efdf0bbcd37d5aaa05649437b286aeecfd38c617.zip |
Improved code for workaround for Qt/Tde/X? bug for handling Meta key as Alt key
in terminal emulation after restored sessions. This relates to bug 1026.
-rw-r--r-- | konsole/konsole/TEWidget.cpp | 15 | ||||
-rw-r--r-- | konsole/konsole/TEWidget.h | 1 | ||||
-rw-r--r-- | konsole/konsole/TEmulation.cpp | 18 | ||||
-rw-r--r-- | konsole/konsole/TEmulation.h | 13 | ||||
-rw-r--r-- | konsole/konsole/konsole.cpp | 22 |
5 files changed, 53 insertions, 16 deletions
diff --git a/konsole/konsole/TEWidget.cpp b/konsole/konsole/TEWidget.cpp index 71db16143..f16d97aac 100644 --- a/konsole/konsole/TEWidget.cpp +++ b/konsole/konsole/TEWidget.cpp @@ -1914,15 +1914,24 @@ bool TEWidget::eventFilter( TQObject *obj, TQEvent *e ) cursorBlinking = false; } - emit keyPressedSignal(ke); // expose + emit keyPressedSignal(ke); return true; } if ( e->type() == TQEvent::KeyRelease ) { - TQKeyEvent* ke = (TQKeyEvent*)e; - emit keyReleasedSignal(ke); // expose + TQKeyEvent *ke = TQT_TQKEYEVENT(e); + emit keyReleasedSignal(ke); return true; } + if ( e->type() == TQEvent::FocusIn ) + { + TQFocusEvent *fe = TQT_TQFOCUSEVENT(e); + if (fe->gotFocus()) + { + emit focusInSignal(fe); + return true; + } + } if ( e->type() == TQEvent::Enter ) { TQObject::disconnect( (TQObject*)cb, TQT_SIGNAL(dataChanged()), diff --git a/konsole/konsole/TEWidget.h b/konsole/konsole/TEWidget.h index 767190e57..2baa2531c 100644 --- a/konsole/konsole/TEWidget.h +++ b/konsole/konsole/TEWidget.h @@ -154,6 +154,7 @@ signals: void keyPressedSignal(TQKeyEvent *e); void keyReleasedSignal(TQKeyEvent *e); + void focusInSignal(TQFocusEvent *e); void mouseSignal(int cb, int cx, int cy); void changedFontMetricSignal(int height, int width); void changedContentSizeSignal(int height, int width); diff --git a/konsole/konsole/TEmulation.cpp b/konsole/konsole/TEmulation.cpp index d7cd13780..7576e9688 100644 --- a/konsole/konsole/TEmulation.cpp +++ b/konsole/konsole/TEmulation.cpp @@ -127,6 +127,8 @@ void TEmulation::connectGUI() this,TQT_SLOT(onKeyPress(TQKeyEvent*))); TQObject::connect(gui,TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), this,TQT_SLOT(onKeyReleased(TQKeyEvent*))); + TQObject::connect(gui,TQT_SIGNAL(focusInSignal(TQFocusEvent*)), + this,TQT_SLOT(onFocusIn(TQFocusEvent*))); TQObject::connect(gui,TQT_SIGNAL(beginSelectionSignal(const int,const int,const bool)), this,TQT_SLOT(onSelectionBegin(const int,const int,const bool)) ); TQObject::connect(gui,TQT_SIGNAL(extendSelectionSignal(const int,const int)), @@ -157,6 +159,8 @@ void TEmulation::changeGUI(TEWidget* newgui) this,TQT_SLOT(onKeyPress(TQKeyEvent*))); TQObject::disconnect(gui,TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), this,TQT_SLOT(onKeyReleased(TQKeyEvent*))); + TQObject::disconnect(gui,TQT_SIGNAL(focusInSignal(TQFocusEvent*)), + this,TQT_SLOT(onFocusIn(TQFocusEvent*))); TQObject::disconnect(gui,TQT_SIGNAL(beginSelectionSignal(const int,const int,const bool)), this,TQT_SLOT(onSelectionBegin(const int,const int,const bool)) ); TQObject::disconnect(gui,TQT_SIGNAL(extendSelectionSignal(const int,const int)), @@ -345,6 +349,20 @@ void TEmulation::doKeyReleased( TQKeyEvent* ke ) { } +void TEmulation::onFocusIn( TQFocusEvent* fe ) +{ + // HACK - workaround for what looks like a bug in Qt. + // Always reset the status of 'metaIsPressed' when the emulation gets the focus, + // to avoid pending cases. A pending case is a case where the emulation lost the + // focus while Meta was pressed but gets the focus when Meta is no longer pressed. + metaIsPressed = false; + doFocusIn(fe); +} + +void TEmulation::doFocusIn( TQFocusEvent* fe ) +{ +} + // Unblocking, Byte to Unicode translation --------------------------------- -- /* diff --git a/konsole/konsole/TEmulation.h b/konsole/konsole/TEmulation.h index b50afc608..9ddc2a4c7 100644 --- a/konsole/konsole/TEmulation.h +++ b/konsole/konsole/TEmulation.h @@ -56,11 +56,14 @@ public slots: // signals incoming from TEWidget virtual void onImageSizeChange(int lines, int columns); virtual void onHistoryCursorChange(int cursor); - // HACK - void onKeyPress(TQKeyEvent*); // This should not be overwritten by derived classes - virtual void doKeyPress(TQKeyEvent*); // Instead this function should be overwritten if necessary - void onKeyReleased(TQKeyEvent*); // This should not be overwritten by derived classes - virtual void doKeyReleased(TQKeyEvent*); // Instead this function should be overwritten if necessary + // HACK - start + void onKeyPress(TQKeyEvent*); // This should not be overwritten by derived classes + virtual void doKeyPress(TQKeyEvent*); // Instead this function should be overwritten if necessary + void onKeyReleased(TQKeyEvent*); // This should not be overwritten by derived classes + virtual void doKeyReleased(TQKeyEvent*); // Instead this function should be overwritten if necessary + void onFocusIn(TQFocusEvent*); // This should not be overwritten by derived classes + virtual void doFocusIn(TQFocusEvent*); // Instead this function should be overwritten if necessary + // HACK - end virtual void clearSelection(); virtual void copySelection(); diff --git a/konsole/konsole/konsole.cpp b/konsole/konsole/konsole.cpp index 646edd96b..569110b08 100644 --- a/konsole/konsole/konsole.cpp +++ b/konsole/konsole/konsole.cpp @@ -2377,10 +2377,12 @@ void Konsole::disableMasterModeConnections() TESession *to = to_it.current(); if (to!=from) { - disconnect(from->widget(),TQT_SIGNAL(keyPressedSignal(TQKeyEvent*)), - to->getEmulation(),TQT_SLOT(onKeyPress(TQKeyEvent*))); - disconnect(from->widget(),TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), - to->getEmulation(),TQT_SLOT(onKeyReleased(TQKeyEvent*))); + disconnect(from->widget(), TQT_SIGNAL(keyPressedSignal(TQKeyEvent*)), + to->getEmulation(), TQT_SLOT(onKeyPress(TQKeyEvent*))); + disconnect(from->widget(), TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), + to->getEmulation(), TQT_SLOT(onKeyReleased(TQKeyEvent*))); + disconnect(from->widget(), TQT_SIGNAL(focusInSignal(TQFocusEvent*)), + to->getEmulation(), TQT_SLOT(onFocusIn(TQFocusEvent*))); } } } @@ -2398,10 +2400,12 @@ void Konsole::enableMasterModeConnections() TESession *to = to_it.current(); if (to!=from) { - connect(from->widget(),TQT_SIGNAL(keyPressedSignal(TQKeyEvent*)), - to->getEmulation(),TQT_SLOT(onKeyPress(TQKeyEvent*))); - connect(from->widget(),TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), - to->getEmulation(),TQT_SLOT(onKeyReleased(TQKeyEvent*))); + connect(from->widget(), TQT_SIGNAL(keyPressedSignal(TQKeyEvent*)), + to->getEmulation(), TQT_SLOT(onKeyPress(TQKeyEvent*))); + connect(from->widget(), TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), + to->getEmulation(), TQT_SLOT(onKeyReleased(TQKeyEvent*))); + connect(from->widget(), TQT_SIGNAL(focusInSignal(TQFocusEvent*)), + to->getEmulation(), TQT_SLOT(onFocusIn(TQFocusEvent*))); } } } @@ -3748,6 +3752,8 @@ void Konsole::detachSession(TESession* _se) { _se->getEmulation(), TQT_SLOT(onKeyPress(TQKeyEvent*))); disconnect(from->widget(), TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), _se->getEmulation(), TQT_SLOT(onKeyReleased(TQKeyEvent*))); + disconnect(from->widget(), TQT_SIGNAL(focusInSignal(TQFocusEvent*)), + _se->getEmulation(), TQT_SLOT(onFocusIn(TQFocusEvent*))); } } } |