diff options
| author | spycrab <spycrab@users.noreply.github.com> | 2019-03-24 15:57:36 +0100 |
|---|---|---|
| committer | spycrab <spycrab@users.noreply.github.com> | 2019-03-26 18:13:32 +0100 |
| commit | f7897778ff3fc752e217de27d6d8fa76984beb3e (patch) | |
| tree | 9230dd529b7e1836397cfebcd330d1f3a1da560a /Source/Core/VideoCommon | |
| parent | eaa1874875187fc247b304a2f6ebd87b0cdc179b (diff) | |
NetPlayChatUI: Add activate chat hotkey
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/NetPlayChatUI.cpp | 13 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/NetPlayChatUI.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/NetPlayChatUI.cpp b/Source/Core/VideoCommon/NetPlayChatUI.cpp index 2388d94b91..7587229ee0 100644 --- a/Source/Core/VideoCommon/NetPlayChatUI.cpp +++ b/Source/Core/VideoCommon/NetPlayChatUI.cpp @@ -60,7 +60,12 @@ void NetPlayChatUI::Display() ImGuiInputTextFlags_EnterReturnsTrue)) { SendMessage(); + } + + if (m_activate) + { ImGui::SetKeyboardFocusHere(-1); + m_activate = false; } ImGui::PopItemWidth(); @@ -97,3 +102,11 @@ void NetPlayChatUI::SendMessage() m_message_buf[0] = '\0'; } } + +void NetPlayChatUI::Activate() +{ + if (ImGui::IsItemFocused()) + ImGui::SetWindowFocus(NULL); + else + m_activate = true; +} diff --git a/Source/Core/VideoCommon/NetPlayChatUI.h b/Source/Core/VideoCommon/NetPlayChatUI.h index c355aa462d..baef71329b 100644 --- a/Source/Core/VideoCommon/NetPlayChatUI.h +++ b/Source/Core/VideoCommon/NetPlayChatUI.h @@ -22,10 +22,12 @@ public: void Display(); void AppendChat(const std::string& message, Color color); void SendMessage(); + void Activate(); private: char m_message_buf[256] = {}; bool m_scroll_to_bottom = false; + bool m_activate = false; bool m_is_scrolled_to_bottom = true; std::deque<std::pair<std::string, Color>> m_messages; |
