mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-07 07:25:26 +00:00
Qt/input: add shortcut for toggling emulated mouse and keyboard
This commit is contained in:
parent
ff84e7c6e2
commit
ff6a4bb72d
21 changed files with 192 additions and 29 deletions
|
|
@ -60,11 +60,22 @@ void basic_keyboard_handler::SetTargetWindow(QWindow* target)
|
|||
|
||||
bool basic_keyboard_handler::eventFilter(QObject* watched, QEvent* event)
|
||||
{
|
||||
if (!event)
|
||||
if (!event) [[unlikely]]
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (input::g_active_mouse_and_keyboard != input::active_mouse_and_keyboard::emulated)
|
||||
{
|
||||
if (!m_keys_released)
|
||||
{
|
||||
ReleaseAllKeys();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
m_keys_released = false;
|
||||
|
||||
// !m_target is for future proofing when gsrender isn't automatically initialized on load.
|
||||
// !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)
|
||||
|
|
@ -97,7 +108,7 @@ bool basic_keyboard_handler::eventFilter(QObject* watched, QEvent* event)
|
|||
|
||||
void basic_keyboard_handler::keyPressEvent(QKeyEvent* keyEvent)
|
||||
{
|
||||
if (!keyEvent)
|
||||
if (!keyEvent) [[unlikely]]
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -118,7 +129,7 @@ void basic_keyboard_handler::keyPressEvent(QKeyEvent* keyEvent)
|
|||
|
||||
void basic_keyboard_handler::keyReleaseEvent(QKeyEvent* keyEvent)
|
||||
{
|
||||
if (!keyEvent)
|
||||
if (!keyEvent) [[unlikely]]
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -141,7 +152,7 @@ void basic_keyboard_handler::keyReleaseEvent(QKeyEvent* keyEvent)
|
|||
// key() only shows the modifiers and the modified key (e.g. no easy way of knowing that - was pressed in 'SHIFT+-' in order to get _)
|
||||
s32 basic_keyboard_handler::getUnmodifiedKey(QKeyEvent* keyEvent)
|
||||
{
|
||||
if (!keyEvent)
|
||||
if (!keyEvent) [[unlikely]]
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue