basic keyboard: release all keys on FocusOut event

This commit is contained in:
Megamouse 2021-04-17 11:22:54 +02:00
parent 67e2e154fa
commit 5416f60643
3 changed files with 33 additions and 6 deletions

View file

@ -62,13 +62,27 @@ bool basic_keyboard_handler::eventFilter(QObject* watched, QEvent* event)
// !m_target->isVisible() is a hack since currently a guiless application will STILL inititialize a gsrender (providing a valid target)
if (!m_target || !m_target->isVisible() || watched == m_target)
{
if (event->type() == QEvent::KeyPress)
switch (event->type())
{
case QEvent::KeyPress:
{
keyPressEvent(static_cast<QKeyEvent*>(event));
break;
}
else if (event->type() == QEvent::KeyRelease)
case QEvent::KeyRelease:
{
keyReleaseEvent(static_cast<QKeyEvent*>(event));
break;
}
case QEvent::FocusOut:
{
ReleaseAllKeys();
break;
}
default:
{
break;
}
}
}
return false;