mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-02 15:02:11 +00:00
improve cellKB keyreleases and autorepeat
This commit is contained in:
parent
9614fef4b9
commit
bb5bdb2e8c
@ -248,6 +248,7 @@ struct KbButton
|
||||
|
||||
struct Keyboard
|
||||
{
|
||||
bool m_key_repeat; // for future use
|
||||
KbData m_data;
|
||||
KbConfig m_config;
|
||||
std::vector<KbButton> m_buttons;
|
||||
@ -255,6 +256,7 @@ struct Keyboard
|
||||
Keyboard()
|
||||
: m_data()
|
||||
, m_config()
|
||||
, m_key_repeat(false)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -274,19 +276,20 @@ public:
|
||||
{
|
||||
for(Keyboard& keyboard : m_keyboards)
|
||||
{
|
||||
KbData& data = keyboard.m_data;
|
||||
KbConfig& config = keyboard.m_config;
|
||||
|
||||
// TODO: handle read modes
|
||||
|
||||
for(KbButton& button : keyboard.m_buttons)
|
||||
{
|
||||
if(button.m_keyCode != code)
|
||||
continue;
|
||||
|
||||
KbData& data = keyboard.m_data;
|
||||
KbConfig& config = keyboard.m_config;
|
||||
|
||||
if (pressed)
|
||||
{
|
||||
// Meta Keys
|
||||
if (code == 308 || code == 307 || code == 306 ||
|
||||
code == 393 || code == 396 || code == 394)
|
||||
if (code == 308 || code == 307 || code == 306 || code == 393 || code == 396 || code == 394)
|
||||
{
|
||||
data.mkey |= button.m_outKeyCode;
|
||||
}
|
||||
@ -310,17 +313,17 @@ public:
|
||||
data.len++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pressed)
|
||||
else
|
||||
{
|
||||
// Meta Keys
|
||||
if (code == 308 || code == 307 || code == 306 ||
|
||||
code == 393 || code == 396 || code == 394)
|
||||
if (code == 308 || code == 307 || code == 306 || code == 393 || code == 396 || code == 394)
|
||||
{
|
||||
data.mkey &= ~button.m_outKeyCode;
|
||||
}
|
||||
// Needed to indicate key releases. Without this you have to tap another key before using the same key again
|
||||
data.keycode[0] = CELL_KEYC_NO_EVENT;
|
||||
data.len = 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,11 +60,21 @@ bool basic_keyboard_handler::eventFilter(QObject* target, QEvent* ev)
|
||||
|
||||
void basic_keyboard_handler::keyPressEvent(QKeyEvent* keyEvent)
|
||||
{
|
||||
if (keyEvent->isAutoRepeat() && !m_keyboards[0].m_key_repeat)
|
||||
{
|
||||
keyEvent->ignore();
|
||||
return;
|
||||
}
|
||||
Key(keyEvent->key(), 1);
|
||||
}
|
||||
|
||||
void basic_keyboard_handler::keyReleaseEvent(QKeyEvent* keyEvent)
|
||||
{
|
||||
if (keyEvent->isAutoRepeat() && !m_keyboards[0].m_key_repeat)
|
||||
{
|
||||
keyEvent->ignore();
|
||||
return;
|
||||
}
|
||||
Key(keyEvent->key(), 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user