mirror of
				https://github.com/kunkundi/crossdesk.git
				synced 2025-10-26 20:25:34 +08:00 
			
		
		
		
	[feat] enable Enter key pressing for ImGui::InputText() method
This commit is contained in:
		| @@ -81,14 +81,17 @@ int Render::ConnectionStatusWindow() { | ||||
|         ImGui::SetNextItemWidth(IPUT_WINDOW_WIDTH / 2); | ||||
|  | ||||
|         ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); | ||||
|         ImGui::InputText("##password", (char *)remote_password_.c_str(), 7, | ||||
|                          ImGuiInputTextFlags_CharsNoBlank); | ||||
|         bool enter_pressed = | ||||
|             ImGui::InputText("##password", (char *)remote_password_.c_str(), 7, | ||||
|                              ImGuiInputTextFlags_CharsNoBlank | | ||||
|                                  ImGuiInputTextFlags_EnterReturnsTrue); | ||||
|         ImGui::PopStyleVar(); | ||||
|  | ||||
|         ImGui::SetCursorPosX(window_width * 0.315f); | ||||
|         ImGui::SetCursorPosY(window_height * 0.75f); | ||||
|         // OK | ||||
|         if (ImGui::Button( | ||||
|         if (enter_pressed || | ||||
|             ImGui::Button( | ||||
|                 localization::ok[localization_language_index_].c_str())) { | ||||
|           show_connection_status_window_ = true; | ||||
|           password_validating_ = true; | ||||
|   | ||||
| @@ -46,12 +46,14 @@ int Render::RemoteWindow() { | ||||
|     ImGui::SetNextItemWidth(IPUT_WINDOW_WIDTH); | ||||
|     ImGui::SetWindowFontScale(1.0f); | ||||
|     ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); | ||||
|     ImGui::InputText( | ||||
|     bool enter_pressed = ImGui::InputText( | ||||
|         "##remote_id_", remote_id_, IM_ARRAYSIZE(remote_id_), | ||||
|         ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank); | ||||
|         ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank | | ||||
|             ImGuiInputTextFlags_EnterReturnsTrue); | ||||
|     ImGui::PopStyleVar(); | ||||
|     ImGui::SameLine(); | ||||
|     if (ImGui::Button(ICON_FA_ARROW_RIGHT_LONG, ImVec2(55, 38)) || rejoin_) { | ||||
|     if (ImGui::Button(ICON_FA_ARROW_RIGHT_LONG, ImVec2(55, 38)) || | ||||
|         enter_pressed || rejoin_) { | ||||
|       connect_button_pressed_ = true; | ||||
|       connection_status_ = ConnectionStatus::Connecting; | ||||
|       int ret = -1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user