mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
UI: Cleanup input box for chat.
This commit is contained in:
parent
f45c5186ca
commit
6b107a884b
3 changed files with 30 additions and 10 deletions
|
@ -23,16 +23,6 @@ void ChatMenu::CreateContents(UI::ViewGroup *parent) {
|
|||
LinearLayout *bottom = outer->Add(new LinearLayout(ORIENT_HORIZONTAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||
#if PPSSPP_PLATFORM(WINDOWS) || defined(USING_QT_UI) || defined(SDL)
|
||||
chatEdit_ = bottom->Add(new TextEdit("", n->T("Chat message"), n->T("Chat Here"), new LinearLayoutParams(1.0)));
|
||||
#if defined(USING_WIN_UI)
|
||||
// freeze the ui when using ctrl + C hotkey need workaround
|
||||
if (g_Config.bBypassOSKWithKeyboard && !g_Config.bFullScreen) {
|
||||
System_InputBoxGetString(n->T("Chat"), n->T("Chat Here"), [](bool result, const std::string &value) {
|
||||
if (result) {
|
||||
sendChat(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
#endif
|
||||
chatEdit_->OnEnter.Handle(this, &ChatMenu::OnSubmit);
|
||||
|
||||
#elif PPSSPP_PLATFORM(ANDROID)
|
||||
|
@ -176,6 +166,8 @@ void ChatMenu::UpdateChat() {
|
|||
}
|
||||
|
||||
void ChatMenu::Update() {
|
||||
auto n = GetI18NCategory("Networking");
|
||||
|
||||
AnchorLayout::Update();
|
||||
if (scroll_ && toBottom_) {
|
||||
toBottom_ = false;
|
||||
|
@ -186,6 +178,27 @@ void ChatMenu::Update() {
|
|||
UpdateChat();
|
||||
updateChatScreen = false;
|
||||
}
|
||||
|
||||
#if defined(USING_WIN_UI)
|
||||
// Could remove the fullscreen check here, it works now.
|
||||
if (promptInput_ && g_Config.bBypassOSKWithKeyboard && !g_Config.bFullScreen) {
|
||||
System_InputBoxGetString(n->T("Chat"), n->T("Chat Here"), [](bool result, const std::string &value) {
|
||||
if (result) {
|
||||
sendChat(value);
|
||||
}
|
||||
});
|
||||
promptInput_ = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ChatMenu::SubviewFocused(UI::View *view) {
|
||||
if (!AnchorLayout::SubviewFocused(view))
|
||||
return false;
|
||||
|
||||
promptInput_ = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ChatMenu::~ChatMenu() {
|
||||
|
|
|
@ -10,6 +10,7 @@ public:
|
|||
}
|
||||
~ChatMenu();
|
||||
void Update() override;
|
||||
bool SubviewFocused(UI::View *view) override;
|
||||
|
||||
bool Contains(float x, float y) const {
|
||||
if (box_)
|
||||
|
@ -37,4 +38,5 @@ private:
|
|||
UI::ViewGroup *box_ = nullptr;
|
||||
|
||||
bool toBottom_ = true;
|
||||
bool promptInput_ = false;
|
||||
};
|
||||
|
|
|
@ -952,7 +952,12 @@ UI::EventReturn EmuScreen::OnChat(UI::EventParams ¶ms) {
|
|||
#if PPSSPP_PLATFORM(WINDOWS) || defined(USING_QT_UI) || defined(SDL)
|
||||
UI::EnableFocusMovement(true);
|
||||
root_->SetDefaultFocusView(chatMenu_);
|
||||
|
||||
chatMenu_->SetFocus();
|
||||
UI::View *focused = UI::GetFocusedView();
|
||||
if (focused) {
|
||||
root_->SubviewFocused(focused);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return UI::EVENT_DONE;
|
||||
|
|
Loading…
Add table
Reference in a new issue