From 059c45f202663ada5a1b578db22bba117c933a06 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 29 Oct 2022 22:28:21 +0200 Subject: [PATCH] overlays: implement osk keyboard cursor actions --- rpcs3/Emu/RSX/Overlays/overlay_osk.cpp | 18 ++++++++++++++++++ rpcs3/Emu/RSX/Overlays/overlay_osk.h | 1 + 2 files changed, 19 insertions(+) diff --git a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp index 2b12f2902b..b1431af574 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp @@ -706,6 +706,18 @@ namespace rsx case CELL_KEYC_ESCAPE: Close(CELL_OSKDIALOG_CLOSE_CANCEL); break; + case CELL_KEYC_RIGHT_ARROW: + on_move_cursor(key, edit_text::direction::right); + break; + case CELL_KEYC_LEFT_ARROW: + on_move_cursor(key, edit_text::direction::left); + break; + case CELL_KEYC_DOWN_ARROW: + on_move_cursor(key, edit_text::direction::down); + break; + case CELL_KEYC_UP_ARROW: + on_move_cursor(key, edit_text::direction::up); + break; case CELL_KEYC_ENTER: if ((flags & CELL_OSKDIALOG_NO_RETURN)) { @@ -833,6 +845,12 @@ namespace rsx } } + void osk_dialog::on_move_cursor(const std::u32string&, edit_text::direction dir) + { + m_preview.move_caret(dir); + m_update = true; + } + std::u32string osk_dialog::get_placeholder() const { const localized_string_id id = m_password_mode diff --git a/rpcs3/Emu/RSX/Overlays/overlay_osk.h b/rpcs3/Emu/RSX/Overlays/overlay_osk.h index 65840ccbe5..c26f536d20 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_osk.h +++ b/rpcs3/Emu/RSX/Overlays/overlay_osk.h @@ -106,6 +106,7 @@ namespace rsx void on_backspace(const std::u32string&); void on_delete(const std::u32string&); void on_enter(const std::u32string&); + void on_move_cursor(const std::u32string&, edit_text::direction dir); std::u32string get_placeholder() const;