From c46927dce664cff658875e70df65c034f694da59 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 19 Aug 2021 11:51:21 -0300 Subject: [PATCH] Save/restore window size of the file selector (fix #2756 in some way) --- src/app/ui/file_selector.cpp | 13 +++++++++++++ src/app/ui/file_selector.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/app/ui/file_selector.cpp b/src/app/ui/file_selector.cpp index 37ac5d1b7..87bafa386 100644 --- a/src/app/ui/file_selector.cpp +++ b/src/app/ui/file_selector.cpp @@ -56,6 +56,8 @@ using namespace ui; namespace { +const char* kConfigSection = "FileSelector"; + template class NullableIterator { public: @@ -428,6 +430,7 @@ bool FileSelector::show( remapWindow(); centerWindow(); + load_window_pos(this, kConfigSection); // Change the file formats/extensions to be shown std::string initialExtension = base::get_file_extension(initialPath); @@ -694,6 +697,16 @@ again: return (!output.empty()); } +bool FileSelector::onProcessMessage(ui::Message* msg) +{ + switch (msg->type()) { + case kCloseMessage: + save_window_pos(this, kConfigSection); + break; + } + return app::gen::FileSelector::onProcessMessage(msg); +} + // Updates the content of the combo-box that shows the current // location in the file-system. void FileSelector::updateLocation() diff --git a/src/app/ui/file_selector.h b/src/app/ui/file_selector.h index 385d86b11..d1b42b76f 100644 --- a/src/app/ui/file_selector.h +++ b/src/app/ui/file_selector.h @@ -45,6 +45,8 @@ namespace app { base::paths& output); private: + bool onProcessMessage(ui::Message* msg) override; + void updateLocation(); void updateNavigationButtons(); void addInNavigationHistory(IFileItem* folder);