Fix display sometimes randomly scrolling down

Something in Qt has changed, so e. g. Super_L isn't passed as a modifier
anymore, so there's a regression from what
eea5ecfc fixed.

This is especially annoying e. g. for people using i3, where just
switching focus away with the keyboard will lead to Konsole scrolling
back to the bottom.
parent fb8890c1
......@@ -240,9 +240,27 @@ void SessionController::trackOutput(QKeyEvent* event)
{
Q_ASSERT(_view->screenWindow());
// Qt has broken something, so we can't rely on just checking if certain
// keys are passed as modifiers anymore.
const int key = event->key();
const bool shouldNotTriggerScroll =
key == Qt::Key_Super_L ||
key == Qt::Key_Super_R ||
key == Qt::Key_Hyper_L ||
key == Qt::Key_Hyper_R ||
key == Qt::Key_Shift ||
key == Qt::Key_Control ||
key == Qt::Key_Meta ||
key == Qt::Key_Alt ||
key == Qt::Key_AltGr ||
key == Qt::Key_CapsLock ||
key == Qt::Key_NumLock ||
key == Qt::Key_ScrollLock;
// Only jump to the bottom if the user actually typed something in,
// not if the user e. g. just pressed a modifier.
if (event->text().isEmpty() && (event->modifiers() != 0u)) {
if (event->text().isEmpty() && (event->modifiers() || shouldNotTriggerScroll)) {
return;
}
......
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