mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
[fix] fix connection error when reinput password
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
|
||||||
int Render::ConnectionStatusWindow(
|
int Render::ConnectionStatusWindow(
|
||||||
std::shared_ptr<SubStreamWindowProperties> &properties) {
|
std::shared_ptr<SubStreamWindowProperties> &props) {
|
||||||
if (show_connection_status_window_) {
|
if (show_connection_status_window_) {
|
||||||
const ImGuiViewport *viewport = ImGui::GetMainViewport();
|
const ImGuiViewport *viewport = ImGui::GetMainViewport();
|
||||||
|
|
||||||
@@ -34,11 +34,11 @@ int Render::ConnectionStatusWindow(
|
|||||||
ImGui::SetWindowFontScale(0.5f);
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
if (ConnectionStatus::Connecting == properties->connection_status_) {
|
if (ConnectionStatus::Connecting == props->connection_status_) {
|
||||||
text = localization::p2p_connecting[localization_language_index_];
|
text = localization::p2p_connecting[localization_language_index_];
|
||||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
} else if (ConnectionStatus::Connected == properties->connection_status_) {
|
} else if (ConnectionStatus::Connected == props->connection_status_) {
|
||||||
text = localization::p2p_connected[localization_language_index_];
|
text = localization::p2p_connected[localization_language_index_];
|
||||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
@@ -49,8 +49,7 @@ int Render::ConnectionStatusWindow(
|
|||||||
ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
||||||
show_connection_status_window_ = false;
|
show_connection_status_window_ = false;
|
||||||
}
|
}
|
||||||
} else if (ConnectionStatus::Disconnected ==
|
} else if (ConnectionStatus::Disconnected == props->connection_status_) {
|
||||||
properties->connection_status_) {
|
|
||||||
text = localization::p2p_disconnected[localization_language_index_];
|
text = localization::p2p_disconnected[localization_language_index_];
|
||||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
@@ -61,7 +60,7 @@ int Render::ConnectionStatusWindow(
|
|||||||
ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
||||||
show_connection_status_window_ = false;
|
show_connection_status_window_ = false;
|
||||||
}
|
}
|
||||||
} else if (ConnectionStatus::Failed == properties->connection_status_) {
|
} else if (ConnectionStatus::Failed == props->connection_status_) {
|
||||||
text = localization::p2p_failed[localization_language_index_];
|
text = localization::p2p_failed[localization_language_index_];
|
||||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
@@ -72,7 +71,7 @@ int Render::ConnectionStatusWindow(
|
|||||||
ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
||||||
show_connection_status_window_ = false;
|
show_connection_status_window_ = false;
|
||||||
}
|
}
|
||||||
} else if (ConnectionStatus::Closed == properties->connection_status_) {
|
} else if (ConnectionStatus::Closed == props->connection_status_) {
|
||||||
text = localization::p2p_closed[localization_language_index_];
|
text = localization::p2p_closed[localization_language_index_];
|
||||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
@@ -84,7 +83,7 @@ int Render::ConnectionStatusWindow(
|
|||||||
show_connection_status_window_ = false;
|
show_connection_status_window_ = false;
|
||||||
}
|
}
|
||||||
} else if (ConnectionStatus::IncorrectPassword ==
|
} else if (ConnectionStatus::IncorrectPassword ==
|
||||||
properties->connection_status_) {
|
props->connection_status_) {
|
||||||
if (!password_validating_) {
|
if (!password_validating_) {
|
||||||
if (password_validating_time_ == 1) {
|
if (password_validating_time_ == 1) {
|
||||||
text = localization::input_password[localization_language_index_];
|
text = localization::input_password[localization_language_index_];
|
||||||
@@ -118,7 +117,7 @@ int Render::ConnectionStatusWindow(
|
|||||||
ImGui::Checkbox(
|
ImGui::Checkbox(
|
||||||
localization::remember_password[localization_language_index_]
|
localization::remember_password[localization_language_index_]
|
||||||
.c_str(),
|
.c_str(),
|
||||||
&(properties->remember_password_));
|
&(props->remember_password_));
|
||||||
ImGui::SetWindowFontScale(0.5f);
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
@@ -130,7 +129,7 @@ int Render::ConnectionStatusWindow(
|
|||||||
ImGui::IsKeyPressed(ImGuiKey_Enter)) {
|
ImGui::IsKeyPressed(ImGuiKey_Enter)) {
|
||||||
show_connection_status_window_ = true;
|
show_connection_status_window_ = true;
|
||||||
password_validating_ = true;
|
password_validating_ = true;
|
||||||
rejoin_ = true;
|
props->rejoin_ = true;
|
||||||
focus_on_input_widget_ = true;
|
focus_on_input_widget_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +148,7 @@ int Render::ConnectionStatusWindow(
|
|||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
}
|
}
|
||||||
} else if (ConnectionStatus::NoSuchTransmissionId ==
|
} else if (ConnectionStatus::NoSuchTransmissionId ==
|
||||||
properties->connection_status_) {
|
props->connection_status_) {
|
||||||
text = localization::no_such_id[localization_language_index_];
|
text = localization::no_such_id[localization_language_index_];
|
||||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, const char *user_id,
|
|||||||
render->password_validating_ = false;
|
render->password_validating_ = false;
|
||||||
render->password_validating_time_++;
|
render->password_validating_time_++;
|
||||||
if (render->connect_button_pressed_) {
|
if (render->connect_button_pressed_) {
|
||||||
|
render->connect_button_pressed_ = false;
|
||||||
props->connection_established_ = false;
|
props->connection_established_ = false;
|
||||||
render->connect_button_label_ =
|
render->connect_button_label_ =
|
||||||
render->connect_button_pressed_
|
render->connect_button_pressed_
|
||||||
|
|||||||
Reference in New Issue
Block a user