From 8b433beff34c382e50334bb59c4f71394845558c Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Mon, 12 Nov 2018 11:08:09 -0500 Subject: software_keyboard: Make GetText asynchronous a --- src/core/frontend/applets/software_keyboard.cpp | 7 ++++--- src/core/frontend/applets/software_keyboard.h | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/core/frontend/applets') diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp index 2445a980d..4105101b3 100644 --- a/src/core/frontend/applets/software_keyboard.cpp +++ b/src/core/frontend/applets/software_keyboard.cpp @@ -9,12 +9,13 @@ namespace Core::Frontend { SoftwareKeyboardApplet::~SoftwareKeyboardApplet() = default; -std::optional DefaultSoftwareKeyboardApplet::GetText( +void DefaultSoftwareKeyboardApplet::RequestText( + std::function)> out, SoftwareKeyboardParameters parameters) const { if (parameters.initial_text.empty()) - return u"yuzu"; + out(u"yuzu"); - return parameters.initial_text; + out(parameters.initial_text); } void DefaultSoftwareKeyboardApplet::SendTextCheckDialog(std::u16string error_message) const { diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h index 7387ee8d7..5420ea883 100644 --- a/src/core/frontend/applets/software_keyboard.h +++ b/src/core/frontend/applets/software_keyboard.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include #include "common/bit_field.h" @@ -36,13 +37,15 @@ class SoftwareKeyboardApplet { public: virtual ~SoftwareKeyboardApplet(); - virtual std::optional GetText(SoftwareKeyboardParameters parameters) const = 0; + virtual void RequestText(std::function)> out, + SoftwareKeyboardParameters parameters) const = 0; virtual void SendTextCheckDialog(std::u16string error_message) const = 0; }; class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet { public: - std::optional GetText(SoftwareKeyboardParameters parameters) const override; + void RequestText(std::function)> out, + SoftwareKeyboardParameters parameters) const override; void SendTextCheckDialog(std::u16string error_message) const override; }; -- cgit v1.2.3