mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-16 17:43:11 +00:00
overlays/osk: handle input device change
This commit is contained in:
parent
5299061282
commit
641fadc1fb
@ -513,6 +513,7 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
|
||||
|
||||
// Set device mask and event lock
|
||||
osk->ignore_input_events = info.lock_ext_input.load();
|
||||
osk->input_device = info.initial_input_device.load();
|
||||
|
||||
if (info.use_separate_windows)
|
||||
{
|
||||
@ -812,7 +813,7 @@ error_code cellOskDialogSetSeparateWindowOption(vm::ptr<CellOskDialogSeparateWin
|
||||
|
||||
error_code cellOskDialogSetInitialInputDevice(u32 inputDevice)
|
||||
{
|
||||
cellOskDialog.todo("cellOskDialogSetInitialInputDevice(inputDevice=%d)", inputDevice);
|
||||
cellOskDialog.warning("cellOskDialogSetInitialInputDevice(inputDevice=%d)", inputDevice);
|
||||
|
||||
if (inputDevice > CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD)
|
||||
{
|
||||
@ -821,9 +822,6 @@ error_code cellOskDialogSetInitialInputDevice(u32 inputDevice)
|
||||
|
||||
g_fxo->get<osk_info>().initial_input_device = static_cast<CellOskDialogInputDevice>(inputDevice);
|
||||
|
||||
// TODO: use initial_input_device
|
||||
// TODO: Signal CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED if the input device changed (probably only when the dialog is already open)
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -311,6 +311,7 @@ public:
|
||||
std::function<void(CellOskDialogKeyMessage key_message)> on_osk_key_input_entered;
|
||||
|
||||
atomic_t<OskDialogState> state{ OskDialogState::Unloaded };
|
||||
atomic_t<CellOskDialogInputDevice> input_device{ CELL_OSKDIALOG_INPUT_DEVICE_PAD }; // The current input device.
|
||||
atomic_t<bool> pad_input_enabled{ true }; // Determines if the OSK consumes the device's events.
|
||||
atomic_t<bool> mouse_input_enabled{ true }; // Determines if the OSK consumes the device's events.
|
||||
atomic_t<bool> keyboard_input_enabled{ true }; // Determines if the OSK consumes the device's events.
|
||||
|
@ -507,6 +507,18 @@ namespace rsx
|
||||
if (!pad_input_enabled || ignore_input_events)
|
||||
return;
|
||||
|
||||
if (input_device.exchange(CELL_OSKDIALOG_INPUT_DEVICE_PAD) != CELL_OSKDIALOG_INPUT_DEVICE_PAD)
|
||||
{
|
||||
sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED, CELL_OSKDIALOG_INPUT_DEVICE_PAD);
|
||||
}
|
||||
|
||||
// Always show the pad input panel if the pad is enabled and in use.
|
||||
if (!m_show_panel)
|
||||
{
|
||||
m_show_panel = true;
|
||||
update_panel();
|
||||
}
|
||||
|
||||
const u32 grid_size = num_columns * num_rows;
|
||||
|
||||
const auto on_accept = [this]()
|
||||
@ -739,9 +751,21 @@ namespace rsx
|
||||
if (!pressed || !keyboard_input_enabled || ignore_input_events)
|
||||
return;
|
||||
|
||||
if (input_device.exchange(CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD) != CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD)
|
||||
{
|
||||
sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED, CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD);
|
||||
}
|
||||
|
||||
if (m_use_separate_windows && m_show_panel)
|
||||
{
|
||||
// Hide the pad input panel if the keyboard is in use during separate windows.
|
||||
m_show_panel = false;
|
||||
update_panel();
|
||||
}
|
||||
|
||||
const bool use_key_string_fallback = !key.empty();
|
||||
|
||||
osk.error("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);
|
||||
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);
|
||||
|
||||
if (!use_key_string_fallback)
|
||||
{
|
||||
@ -1153,10 +1177,8 @@ namespace rsx
|
||||
|
||||
if (m_use_separate_windows)
|
||||
{
|
||||
// When using separate windows, we show the text field, but hide the pad input panel if the device mask contains CELL_OSKDIALOG_DEVICE_MASK_PAD.
|
||||
// TODO: If controller input is allowed and the user presses a button, show the pad input panel.
|
||||
// TODO: If keyboard input is allowed and the user presses a key, hide the pad input panel.
|
||||
m_show_panel = pad_input_enabled;
|
||||
// When using separate windows, we show the text field, but hide the pad input panel if the input device is a pad.
|
||||
m_show_panel = pad_input_enabled && input_device == CELL_OSKDIALOG_INPUT_DEVICE_PAD;
|
||||
m_title.back_color.a = std::clamp(params.input_field_background_transparency, 0.0f, 1.0f);
|
||||
m_preview.back_color.a = std::clamp(params.input_field_background_transparency, 0.0f, 1.0f);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user