1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

overlays/osk: fix cellOskDialogExtInputDeviceLock

This commit is contained in:
Megamouse 2023-01-22 17:01:33 +01:00
parent 1e6c180690
commit 6106ff8b31
4 changed files with 27 additions and 17 deletions

View File

@ -57,7 +57,7 @@ void osk_info::reset()
dlg.reset();
valid_text = {};
use_separate_windows = false;
lock_ext_input = false;
lock_ext_input_device = false;
device_mask = 0;
input_field_window_width = 0;
input_field_background_transparency = 1.0f;
@ -578,7 +578,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->ignore_device_events = info.lock_ext_input_device.load();
osk->input_device = info.initial_input_device.load();
osk->continuous_mode = info.osk_continuous_mode.load();
@ -882,7 +882,7 @@ error_code cellOskDialogSetSeparateWindowOption(vm::ptr<CellOskDialogSeparateWin
osk.input_panel_layout_info = osk.input_field_layout_info;
}
cellOskDialog.warning("cellOskDialogSetSeparateWindowOption: use_separate_windows=true, continuous_mode=%s, device_mask=0x%x, input_field_window_width=%f, input_field_background_transparency=%.2f, input_field_layout_info=%s, input_panel_layout_info=%s)",
cellOskDialog.warning("cellOskDialogSetSeparateWindowOption: use_separate_windows=true, continuous_mode=%s, device_mask=0x%x, input_field_window_width=%d, input_field_background_transparency=%.2f, input_field_layout_info=%s, input_panel_layout_info=%s)",
osk.osk_continuous_mode.load(), osk.device_mask.load(), osk.input_field_window_width.load(), osk.input_field_background_transparency.load(), osk.input_field_layout_info, osk.input_panel_layout_info);
return CELL_OK;
@ -1118,11 +1118,11 @@ error_code cellOskDialogExtInputDeviceLock()
{
cellOskDialog.warning("cellOskDialogExtInputDeviceLock()");
g_fxo->get<osk_info>().lock_ext_input = true;
g_fxo->get<osk_info>().lock_ext_input_device = true;
if (const auto osk = _get_osk_dialog(false))
{
osk->ignore_input_events = true;
osk->ignore_device_events = true;
}
return CELL_OK;
@ -1132,11 +1132,11 @@ error_code cellOskDialogExtInputDeviceUnlock()
{
cellOskDialog.warning("cellOskDialogExtInputDeviceUnlock()");
g_fxo->get<osk_info>().lock_ext_input = false;
g_fxo->get<osk_info>().lock_ext_input_device = false;
if (const auto osk = _get_osk_dialog(false))
{
osk->ignore_input_events = false;
osk->ignore_device_events = false;
}
return CELL_OK;

View File

@ -315,10 +315,10 @@ public:
atomic_t<OskDialogState> state{ OskDialogState::Unloaded };
atomic_t<CellOskDialogContinuousMode> continuous_mode{ CELL_OSKDIALOG_CONTINUOUS_MODE_NONE };
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.
atomic_t<bool> ignore_input_events{ false }; // Determines if the OSK ignores all consumed events.
atomic_t<bool> pad_input_enabled{ true }; // Determines if the OSK consumes the device's input.
atomic_t<bool> mouse_input_enabled{ true }; // Determines if the OSK consumes the device's input.
atomic_t<bool> keyboard_input_enabled{ true }; // Determines if the OSK consumes the device's input.
atomic_t<bool> ignore_device_events{ false }; // Determines if the OSK ignores device events.
atomic_t<CellOskDialogInputFieldResult> osk_input_result{ CellOskDialogInputFieldResult::CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK };
char16_t osk_text[CELL_OSKDIALOG_STRING_SIZE]{};
@ -333,7 +333,7 @@ struct osk_info
atomic_t<bool> use_separate_windows = false;
atomic_t<bool> lock_ext_input = false;
atomic_t<bool> lock_ext_input_device = false;
atomic_t<u32> device_mask = 0; // OSK ignores input from the specified devices. 0 means all devices can influence the OSK
atomic_t<u32> input_field_window_width = 0;
atomic_t<f32> input_field_background_transparency = 1.0f;

View File

@ -555,15 +555,20 @@ namespace rsx
void osk_dialog::on_button_pressed(pad_button button_press)
{
if (!pad_input_enabled || ignore_input_events)
if (!pad_input_enabled)
return;
if (input_device.exchange(CELL_OSKDIALOG_INPUT_DEVICE_PAD) != CELL_OSKDIALOG_INPUT_DEVICE_PAD)
if (!ignore_device_events && input_device.exchange(CELL_OSKDIALOG_INPUT_DEVICE_PAD) != CELL_OSKDIALOG_INPUT_DEVICE_PAD)
{
osk.notice("on_button_pressed: sending CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED with CELL_OSKDIALOG_INPUT_DEVICE_PAD");
sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED, CELL_OSKDIALOG_INPUT_DEVICE_PAD);
}
if (input_device != CELL_OSKDIALOG_INPUT_DEVICE_PAD)
{
return;
}
// Always show the pad input panel if the pad is enabled and in use.
if (!m_show_panel)
{
@ -800,15 +805,20 @@ namespace rsx
void osk_dialog::on_key_pressed(u32 led, u32 mkey, u32 key_code, u32 out_key_code, bool pressed, std::u32string key)
{
if (!pressed || !keyboard_input_enabled || ignore_input_events)
if (!pressed || !keyboard_input_enabled)
return;
if (input_device.exchange(CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD) != CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD)
if (!ignore_device_events && input_device.exchange(CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD) != CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD)
{
osk.notice("on_key_pressed: sending CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED with CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD");
sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED, CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD);
}
if (input_device != CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD)
{
return;
}
if (m_use_separate_windows && m_show_panel)
{
// Hide the pad input panel if the keyboard is in use during separate windows.

View File

@ -113,7 +113,7 @@ namespace rsx
bool m_start_pad_interception = true;
atomic_t<bool> m_stop_pad_interception = false;
atomic_t<u64> thread_bits = 0;
bool m_keyboard_input_enabled = false; // Allow keyboard events
bool m_keyboard_input_enabled = false; // Allow keyboard input
bool m_keyboard_pad_handler_active = true; // Initialized as true to prevent keyboard input until proven otherwise.
bool m_allow_input_on_pause = false;