mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35: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::SetNextItemWidth(IPUT_WINDOW_WIDTH / 2);
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
||||||
ImGui::InputText("##password", (char *)remote_password_.c_str(), 7,
|
bool enter_pressed =
|
||||||
ImGuiInputTextFlags_CharsNoBlank);
|
ImGui::InputText("##password", (char *)remote_password_.c_str(), 7,
|
||||||
|
ImGuiInputTextFlags_CharsNoBlank |
|
||||||
|
ImGuiInputTextFlags_EnterReturnsTrue);
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
ImGui::SetCursorPosX(window_width * 0.315f);
|
ImGui::SetCursorPosX(window_width * 0.315f);
|
||||||
ImGui::SetCursorPosY(window_height * 0.75f);
|
ImGui::SetCursorPosY(window_height * 0.75f);
|
||||||
// OK
|
// OK
|
||||||
if (ImGui::Button(
|
if (enter_pressed ||
|
||||||
|
ImGui::Button(
|
||||||
localization::ok[localization_language_index_].c_str())) {
|
localization::ok[localization_language_index_].c_str())) {
|
||||||
show_connection_status_window_ = true;
|
show_connection_status_window_ = true;
|
||||||
password_validating_ = true;
|
password_validating_ = true;
|
||||||
|
|||||||
@@ -46,12 +46,14 @@ int Render::RemoteWindow() {
|
|||||||
ImGui::SetNextItemWidth(IPUT_WINDOW_WIDTH);
|
ImGui::SetNextItemWidth(IPUT_WINDOW_WIDTH);
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
||||||
ImGui::InputText(
|
bool enter_pressed = ImGui::InputText(
|
||||||
"##remote_id_", remote_id_, IM_ARRAYSIZE(remote_id_),
|
"##remote_id_", remote_id_, IM_ARRAYSIZE(remote_id_),
|
||||||
ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank);
|
ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank |
|
||||||
|
ImGuiInputTextFlags_EnterReturnsTrue);
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
ImGui::SameLine();
|
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;
|
connect_button_pressed_ = true;
|
||||||
connection_status_ = ConnectionStatus::Connecting;
|
connection_status_ = ConnectionStatus::Connecting;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user