From e1bd5c092bd3ddbf7cd5176332cbefa65625a4fb Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 22 Dec 2018 17:12:33 +0100 Subject: [PATCH] Pressing enter key when entering client address automatically connects. --- profiler/src/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index eb3edf60..ed448b76 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -274,7 +274,8 @@ int main( int argc, char** argv ) } ImGui::Separator(); ImGui::Text( "Connect to client" ); - ImGui::InputText( "", addr, 1024 ); + bool connectClicked = false; + connectClicked |= ImGui::InputText( "", addr, 1024, ImGuiInputTextFlags_EnterReturnsTrue ); if( !connHistVec.empty() ) { ImGui::SameLine(); @@ -302,7 +303,8 @@ int main( int argc, char** argv ) ImGui::EndCombo(); } } - if( ImGui::Button( ICON_FA_WIFI " Connect" ) && *addr && !loadThread.joinable() ) + connectClicked |= ImGui::Button( ICON_FA_WIFI " Connect" ); + if( connectClicked && *addr && !loadThread.joinable() ) { std::string addrStr( addr ); auto it = connHistMap.find( addr );