mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
Reset settings window position before it is opened
This commit is contained in:
@@ -519,12 +519,24 @@ int MainWindow::Run() {
|
|||||||
|
|
||||||
if (ImGui::Button(settings_button_label_.c_str())) {
|
if (ImGui::Button(settings_button_label_.c_str())) {
|
||||||
settings_button_pressed_ = !settings_button_pressed_;
|
settings_button_pressed_ = !settings_button_pressed_;
|
||||||
|
settings_window_pos_reset_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings_button_pressed_) {
|
if (settings_button_pressed_) {
|
||||||
ImGui::SetNextWindowSize(ImVec2(
|
if (settings_window_pos_reset_) {
|
||||||
localization::settings_window_width[localization_language_index_],
|
const ImGuiViewport *viewport = ImGui::GetMainViewport();
|
||||||
190));
|
ImGui::SetNextWindowPos(
|
||||||
|
ImVec2((viewport->WorkSize.x - viewport->WorkPos.x -
|
||||||
|
localization::settings_window_width
|
||||||
|
[localization_language_index_]) /
|
||||||
|
2,
|
||||||
|
(viewport->WorkSize.y - viewport->WorkPos.y - 190) / 2));
|
||||||
|
|
||||||
|
ImGui::SetNextWindowSize(ImVec2(
|
||||||
|
localization::settings_window_width[localization_language_index_],
|
||||||
|
190));
|
||||||
|
settings_window_pos_reset_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Begin(
|
ImGui::Begin(
|
||||||
localization::settings[localization_language_index_].c_str(),
|
localization::settings[localization_language_index_].c_str(),
|
||||||
@@ -657,6 +669,7 @@ int MainWindow::Run() {
|
|||||||
|
|
||||||
SaveSettingsIntoCacheFile();
|
SaveSettingsIntoCacheFile();
|
||||||
// To do: set encode resolution
|
// To do: set encode resolution
|
||||||
|
settings_window_pos_reset_ = true;
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
// Cancel
|
// Cancel
|
||||||
@@ -676,6 +689,7 @@ int MainWindow::Run() {
|
|||||||
video_video_encode_format_button_value_ =
|
video_video_encode_format_button_value_ =
|
||||||
video_video_encode_format_button_value_last_;
|
video_video_encode_format_button_value_last_;
|
||||||
}
|
}
|
||||||
|
settings_window_pos_reset_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|||||||
@@ -185,6 +185,9 @@ class MainWindow {
|
|||||||
std::atomic<bool> start_mouse_control_{false};
|
std::atomic<bool> start_mouse_control_{false};
|
||||||
std::atomic<bool> screen_capture_is_started_{false};
|
std::atomic<bool> screen_capture_is_started_{false};
|
||||||
std::atomic<bool> mouse_control_is_started_{false};
|
std::atomic<bool> mouse_control_is_started_{false};
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool settings_window_pos_reset_ = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user