Cache HasFilePicker() value in UiContext

This commit is contained in:
Michael Steenbeek 2021-03-20 14:51:15 +01:00 committed by GitHub
parent f1cd58c292
commit 430711a33b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -3,6 +3,7 @@
- Feature: [#14071] “Vandals stopped” statistic for security guards.
- Feature: [#14296] Allow using early scenario completion in multiplayer.
- Fix: [#11829] Visual glitches and crashes when using RCT1 assets from mismatched or corrupt CSG1.DAT and CSG1i.DAT files.
- Fix: [#13581] Opening the Options menu causes a noticeable drop in FPS.
- Fix: [#13894] Block brakes do not animate.
- Fix: [#14315] Crash when trying to rename Air Powered Vertical Coaster in Korean.
- Fix: [#14330] join_server uses default_port from config.

View File

@ -35,6 +35,8 @@ namespace OpenRCT2::Ui
class LinuxContext final : public IPlatformUiContext
{
private:
mutable std::optional<bool> _hasFilePicker = std::nullopt;
public:
LinuxContext()
{
@ -253,8 +255,13 @@ namespace OpenRCT2::Ui
bool HasFilePicker() const override
{
std::string dummy;
return GetDialogApp(&dummy) != DIALOG_TYPE::NONE;
if (!_hasFilePicker.has_value())
{
std::string dummy;
_hasFilePicker = (GetDialogApp(&dummy) != DIALOG_TYPE::NONE);
}
return _hasFilePicker.value();
}
bool HasMenuSupport() override