mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 10:42:36 +01:00
basic keyboard: release all keys on FocusOut event
This commit is contained in:
parent
67e2e154fa
commit
5416f60643
@ -186,3 +186,14 @@ void KeyboardHandlerBase::SetIntercepted(bool intercepted)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeyboardHandlerBase::ReleaseAllKeys()
|
||||||
|
{
|
||||||
|
for (const Keyboard& keyboard : m_keyboards)
|
||||||
|
{
|
||||||
|
for (const KbButton& button : keyboard.m_buttons)
|
||||||
|
{
|
||||||
|
Key(button.m_keyCode, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -86,10 +86,6 @@ struct Keyboard
|
|||||||
|
|
||||||
class KeyboardHandlerBase
|
class KeyboardHandlerBase
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
KbInfo m_info;
|
|
||||||
std::vector<Keyboard> m_keyboards;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
|
|
||||||
@ -109,4 +105,10 @@ public:
|
|||||||
KbConfig& GetConfig(const u32 keyboard) { return m_keyboards[keyboard].m_config; }
|
KbConfig& GetConfig(const u32 keyboard) { return m_keyboards[keyboard].m_config; }
|
||||||
|
|
||||||
stx::init_mutex init;
|
stx::init_mutex init;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void ReleaseAllKeys();
|
||||||
|
|
||||||
|
KbInfo m_info;
|
||||||
|
std::vector<Keyboard> m_keyboards;
|
||||||
};
|
};
|
||||||
|
@ -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)
|
// !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 (!m_target || !m_target->isVisible() || watched == m_target)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::KeyPress)
|
switch (event->type())
|
||||||
|
{
|
||||||
|
case QEvent::KeyPress:
|
||||||
{
|
{
|
||||||
keyPressEvent(static_cast<QKeyEvent*>(event));
|
keyPressEvent(static_cast<QKeyEvent*>(event));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (event->type() == QEvent::KeyRelease)
|
case QEvent::KeyRelease:
|
||||||
{
|
{
|
||||||
keyReleaseEvent(static_cast<QKeyEvent*>(event));
|
keyReleaseEvent(static_cast<QKeyEvent*>(event));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QEvent::FocusOut:
|
||||||
|
{
|
||||||
|
ReleaseAllKeys();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user