mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
[feat] let keyboard focus on input widget when needs to input password
This commit is contained in:
@@ -81,10 +81,16 @@ 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);
|
||||||
|
|
||||||
|
if (focus_on_input_widget_) {
|
||||||
|
ImGui::SetKeyboardFocusHere();
|
||||||
|
focus_on_input_widget_ = false;
|
||||||
|
}
|
||||||
bool enter_pressed =
|
bool enter_pressed =
|
||||||
ImGui::InputText("##password", (char *)remote_password_.c_str(), 7,
|
ImGui::InputText("##password", (char *)remote_password_.c_str(), 7,
|
||||||
ImGuiInputTextFlags_CharsNoBlank |
|
ImGuiInputTextFlags_CharsNoBlank |
|
||||||
ImGuiInputTextFlags_EnterReturnsTrue);
|
ImGuiInputTextFlags_EnterReturnsTrue);
|
||||||
|
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
ImGui::SetCursorPosX(window_width * 0.315f);
|
ImGui::SetCursorPosX(window_width * 0.315f);
|
||||||
@@ -96,6 +102,7 @@ int Render::ConnectionStatusWindow() {
|
|||||||
show_connection_status_window_ = true;
|
show_connection_status_window_ = true;
|
||||||
password_validating_ = true;
|
password_validating_ = true;
|
||||||
rejoin_ = true;
|
rejoin_ = true;
|
||||||
|
focus_on_input_widget_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@@ -104,6 +111,7 @@ int Render::ConnectionStatusWindow() {
|
|||||||
localization::cancel[localization_language_index_].c_str())) {
|
localization::cancel[localization_language_index_].c_str())) {
|
||||||
remote_password_ = "";
|
remote_password_ = "";
|
||||||
show_connection_status_window_ = false;
|
show_connection_status_window_ = false;
|
||||||
|
focus_on_input_widget_ = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
text = localization::validate_password[localization_language_index_];
|
text = localization::validate_password[localization_language_index_];
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ class Render {
|
|||||||
bool regenerate_password_ = false;
|
bool regenerate_password_ = false;
|
||||||
bool show_about_window_ = false;
|
bool show_about_window_ = false;
|
||||||
bool show_connection_status_window_ = false;
|
bool show_connection_status_window_ = false;
|
||||||
|
bool focus_on_input_widget_ = true;
|
||||||
bool window_maximized_ = false;
|
bool window_maximized_ = false;
|
||||||
bool streaming_ = false;
|
bool streaming_ = false;
|
||||||
bool is_client_mode_ = false;
|
bool is_client_mode_ = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user