diff --git a/src/gui/BrowserDialog.cxx b/src/gui/BrowserDialog.cxx index a93fe5a3b..2947efdf2 100644 --- a/src/gui/BrowserDialog.cxx +++ b/src/gui/BrowserDialog.cxx @@ -29,8 +29,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font, - int max_w, int max_h, const string& title) - : Dialog(boss->instance(), boss->parent(), font, title) + int max_w, int max_h) + : Dialog(boss->instance(), boss->parent(), font, "Title") // dummy title value! { // Set real dimensions _w = max_w; @@ -122,13 +122,18 @@ void BrowserDialog::show(GuiObject* parent, const GUI::Font& font, const FilesystemNode::NameFilter& namefilter) { uInt32 w = 0, h = 0; + static_cast(parent)->getDynamicBounds(w, h); if(w > uInt32(font.getMaxCharWidth() * 80)) w = font.getMaxCharWidth() * 80; - static unique_ptr ourBrowser = - make_unique(parent, font, w, h, title); + static unique_ptr ourBrowser{nullptr}; + if(ourBrowser == nullptr + || ourBrowser->getWidth() != int(w) || ourBrowser->getHeight() != int(h)) + ourBrowser = make_unique(parent, font, w, h); + + ourBrowser->setTitle(title); // has to be always updated! ourBrowser->show(startpath, mode, command, namefilter); } diff --git a/src/gui/BrowserDialog.hxx b/src/gui/BrowserDialog.hxx index 466c43242..88e64832f 100644 --- a/src/gui/BrowserDialog.hxx +++ b/src/gui/BrowserDialog.hxx @@ -47,8 +47,7 @@ class BrowserDialog : public Dialog public: // NOTE: Do not call this c'tor directly! Use the static show method below // There is no point in doing so, since the result can't be returned - BrowserDialog(GuiObject* boss, const GUI::Font& font, int max_w, int max_h, - const string& title); + BrowserDialog(GuiObject* boss, const GUI::Font& font, int max_w, int max_h); ~BrowserDialog() override = default; /**