applets/swkbd: Skip text checking if the text has been confirmed
Confirm means that the text has already been checked by the application to be correct, but is asking the user for confirmation. The confirmation text itself seems to be corrupted though, this needs to be investigated. Fixes the software keyboard in Famicom Detective Club: The Missing Heir
This commit is contained in:
parent
ced1302975
commit
1af499c15b
8 changed files with 36 additions and 26 deletions
|
@ -16,7 +16,8 @@ DefaultSoftwareKeyboardApplet::~DefaultSoftwareKeyboardApplet() = default;
|
|||
|
||||
void DefaultSoftwareKeyboardApplet::InitializeKeyboard(
|
||||
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string)> submit_normal_callback_,
|
||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
||||
submit_normal_callback_,
|
||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
||||
submit_inline_callback_) {
|
||||
if (is_inline) {
|
||||
|
@ -128,7 +129,7 @@ void DefaultSoftwareKeyboardApplet::ExitKeyboard() const {
|
|||
}
|
||||
|
||||
void DefaultSoftwareKeyboardApplet::SubmitNormalText(std::u16string text) const {
|
||||
submit_normal_callback(Service::AM::Applets::SwkbdResult::Ok, text);
|
||||
submit_normal_callback(Service::AM::Applets::SwkbdResult::Ok, text, true);
|
||||
}
|
||||
|
||||
void DefaultSoftwareKeyboardApplet::SubmitInlineText(std::u16string_view text) const {
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
virtual void InitializeKeyboard(
|
||||
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string)>
|
||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
||||
submit_normal_callback_,
|
||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
||||
submit_inline_callback_) = 0;
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
|
||||
void InitializeKeyboard(
|
||||
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string)>
|
||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
||||
submit_normal_callback_,
|
||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
||||
submit_inline_callback_) override;
|
||||
|
@ -106,7 +106,7 @@ private:
|
|||
|
||||
KeyboardInitializeParameters parameters;
|
||||
|
||||
mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string)>
|
||||
mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
||||
submit_normal_callback;
|
||||
mutable std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
||||
submit_inline_callback;
|
||||
|
|
|
@ -109,13 +109,18 @@ void SoftwareKeyboard::Execute() {
|
|||
ShowNormalKeyboard();
|
||||
}
|
||||
|
||||
void SoftwareKeyboard::SubmitTextNormal(SwkbdResult result, std::u16string submitted_text) {
|
||||
void SoftwareKeyboard::SubmitTextNormal(SwkbdResult result, std::u16string submitted_text,
|
||||
bool confirmed) {
|
||||
if (complete) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (swkbd_config_common.use_text_check && result == SwkbdResult::Ok) {
|
||||
SubmitForTextCheck(submitted_text);
|
||||
if (confirmed) {
|
||||
SubmitNormalOutputAndExit(result, submitted_text);
|
||||
} else {
|
||||
SubmitForTextCheck(submitted_text);
|
||||
}
|
||||
} else {
|
||||
SubmitNormalOutputAndExit(result, submitted_text);
|
||||
}
|
||||
|
@ -583,11 +588,12 @@ void SoftwareKeyboard::InitializeFrontendKeyboard() {
|
|||
.disable_cancel_button{disable_cancel_button},
|
||||
};
|
||||
|
||||
frontend.InitializeKeyboard(false, std::move(initialize_parameters),
|
||||
[this](SwkbdResult result, std::u16string submitted_text) {
|
||||
SubmitTextNormal(result, submitted_text);
|
||||
},
|
||||
{});
|
||||
frontend.InitializeKeyboard(
|
||||
false, std::move(initialize_parameters),
|
||||
[this](SwkbdResult result, std::u16string submitted_text, bool confirmed) {
|
||||
SubmitTextNormal(result, submitted_text, confirmed);
|
||||
},
|
||||
{});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,9 @@ public:
|
|||
*
|
||||
* @param result SwkbdResult enum
|
||||
* @param submitted_text UTF-16 encoded string
|
||||
* @param confirmed Whether the text has been confirmed after TextCheckResult::Confirm
|
||||
*/
|
||||
void SubmitTextNormal(SwkbdResult result, std::u16string submitted_text);
|
||||
void SubmitTextNormal(SwkbdResult result, std::u16string submitted_text, bool confirmed);
|
||||
|
||||
/**
|
||||
* Submits the input text to the application.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue