mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
overlays/osk: Don't use meta out key code in the osk overlay
The out key code is simply used to store the meta key ID. It is not meant to be a real key code.
This commit is contained in:
parent
e3f6bbfcc9
commit
1444981bdc
1 changed files with 33 additions and 15 deletions
|
@ -927,11 +927,27 @@ namespace rsx
|
||||||
|
|
||||||
std::lock_guard lock(m_preview_mutex);
|
std::lock_guard lock(m_preview_mutex);
|
||||||
|
|
||||||
const bool use_key_string_fallback = !key.empty();
|
// The key should normally be empty unless the backend couldn't find a match.
|
||||||
|
const bool is_key_string_fallback = !key.empty();
|
||||||
|
|
||||||
osk.notice("osk_dialog::on_key_pressed(led=%d, mkey=%d, key_code=%d, out_key_code=%d, pressed=%d, use_key_string_fallback=%d)", led, mkey, key_code, out_key_code, pressed, use_key_string_fallback);
|
// Pure meta keys need to be treated with care, as their out key code contains the meta key code instead of the normal key code.
|
||||||
|
const bool is_meta_key = mkey != 0 && key_code == CELL_KEYC_NO_EVENT && key.empty();
|
||||||
|
|
||||||
if (!use_key_string_fallback)
|
osk.notice("osk_dialog::on_key_pressed(led=%d, mkey=%d, key_code=%d, out_key_code=%d, pressed=%d, is_key_string_fallback=%d, is_meta_key=%d)", led, mkey, key_code, out_key_code, pressed, is_key_string_fallback, is_meta_key);
|
||||||
|
|
||||||
|
// Find matching key in the OSK
|
||||||
|
const auto find_key = [&]() -> bool
|
||||||
|
{
|
||||||
|
if (is_meta_key)
|
||||||
|
{
|
||||||
|
// We don't need to process meta keys in the grid at the moment.
|
||||||
|
// The key is valid either way, so we return true.
|
||||||
|
// Only on_osk_key_input_entered is called later.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the string representation of this key (unless it's already set by the backend)
|
||||||
|
if (key.empty())
|
||||||
{
|
{
|
||||||
// Get keyboard layout
|
// Get keyboard layout
|
||||||
const u32 kb_mapping = static_cast<u32>(g_cfg.sys.keyboard_type.get());
|
const u32 kb_mapping = static_cast<u32>(g_cfg.sys.keyboard_type.get());
|
||||||
|
@ -943,9 +959,11 @@ namespace rsx
|
||||||
key = utf16_to_u32string(utf16_string);
|
key = utf16_to_u32string(utf16_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find matching key in the OSK
|
if (key.empty())
|
||||||
const auto find_key = [&]() -> bool
|
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (const cell& current_cell : m_grid)
|
for (const cell& current_cell : m_grid)
|
||||||
{
|
{
|
||||||
for (const auto& output : current_cell.outputs)
|
for (const auto& output : current_cell.outputs)
|
||||||
|
@ -975,9 +993,9 @@ namespace rsx
|
||||||
|
|
||||||
const bool found_key = find_key();
|
const bool found_key = find_key();
|
||||||
|
|
||||||
if (use_key_string_fallback)
|
if (is_key_string_fallback)
|
||||||
{
|
{
|
||||||
// We don't have a keycode, so there we can't process any of the following code anyway
|
// We don't have a keycode, so we can't process any of the following code anyway
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue