Commit 2f3d5f3b authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark Committed by Kurt Hindenburg
Browse files

Make sure the keypress event doesn't "leak" if handled

parent ab837e9c
......@@ -178,7 +178,7 @@ static int ascii_to_int(int c) {
return c - '0';
}
void FilterChain::keyPressEvent(TerminalDisplay *td, QKeyEvent *ev, int charLine, int charColumn)
bool FilterChain::keyPressEvent(TerminalDisplay *td, QKeyEvent *ev, int charLine, int charColumn)
{
if ((_urlHintsModifiers != 0u) && ev->modifiers() == _urlHintsModifiers) {
QList<QSharedPointer<HotSpot>> hotspots = filterBy(HotSpot::Link);
......@@ -193,7 +193,7 @@ void FilterChain::keyPressEvent(TerminalDisplay *td, QKeyEvent *ev, int charLine
hotspots.at(hintSelected)->activate();
_showUrlHint = false;
td->update();
return;
return true;
}
if (!_showUrlHint) {
......@@ -207,6 +207,7 @@ void FilterChain::keyPressEvent(TerminalDisplay *td, QKeyEvent *ev, int charLine
if (spot) {
spot->keyPressEvent(td, ev);
}
return false;
}
void FilterChain::mouseMoveEvent(TerminalDisplay *td, QMouseEvent *ev, int charLine, int charColumn)
......
......@@ -91,7 +91,7 @@ public:
void mouseMoveEvent(TerminalDisplay *td, QMouseEvent *ev, int charLine, int charColumn);
void mouseReleaseEvent(TerminalDisplay *td, QMouseEvent *ev, int charLine, int charColumn);
void keyPressEvent(TerminalDisplay *td, QKeyEvent *ev, int charLine, int charColumn);
bool keyPressEvent(TerminalDisplay *td, QKeyEvent *ev, int charLine, int charColumn);
void keyReleaseEvent(TerminalDisplay *td, QKeyEvent *ev, int charLine, int charColumn);
void leaveEvent(TerminalDisplay *td, QEvent *ev);
......
......@@ -3494,7 +3494,11 @@ void TerminalDisplay::keyPressEvent(QKeyEvent* event)
int charLine;
int charColumn;
getCharacterPosition(mapFromGlobal(QCursor::pos()), charLine, charColumn, !_usesMouseTracking);
_filterChain->keyPressEvent(this, event, charLine, charColumn);
// Don't process it if the filterchain handled it for us
if (_filterChain->keyPressEvent(this, event, charLine, charColumn)) {
return;
}
}
if (!_peekPrimaryShortcut.isEmpty() && _peekPrimaryShortcut.matches(QKeySequence(event->key() | event->modifiers()))) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment