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.
pull/2/head
Michele Calgaro 10 years ago
parent 83708272fb
commit efdf0bbcd3

@ -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()),

@ -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);

@ -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 --------------------------------- --
/*

@ -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();

@ -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*)));
}
}
}

Loading…
Cancel
Save