diff options
author | Avery <cattata1056@gmail.com> | 2020-09-02 20:53:49 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-03 11:03:16 +0200 |
commit | 1da38eeb3c198efb01d052761ffa275704999b01 (patch) | |
tree | 7777fefea286e0dd9a5455bb5b6897dab6e0e6ce | |
parent | 6fe37cb471b46dda7c222fc798a566aaca2475d0 (diff) | |
download | serenity-1da38eeb3c198efb01d052761ffa275704999b01.zip |
DisplaySettings: Remove unnecessary file open for non-paths
Currently, every time the wallpaper picker changes, an additional
attempted file load happens on top of the file load to create the
bitmap. The only values that the wallpaper picker can take on are
filenames that can never be valid when loaded without the /res/wallpaper
prefix. To reduce the amount of log spam and speed up wallpaper picking,
this patch only attempts to load wallpapers with slash-prefixed names,
assumed to be the absolute path to that wallpaper. Additional wallpapers
outside of /res/wallpapers/ should still be accessible with this patch,
and the experience is improved for the more common case of selecting a
built-in wallpaper.
-rw-r--r-- | Applications/DisplaySettings/DisplaySettings.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Applications/DisplaySettings/DisplaySettings.cpp b/Applications/DisplaySettings/DisplaySettings.cpp index 6ef0f91c44..0dd3c8248a 100644 --- a/Applications/DisplaySettings/DisplaySettings.cpp +++ b/Applications/DisplaySettings/DisplaySettings.cpp @@ -125,7 +125,7 @@ void DisplaySettingsWidget::create_frame() m_wallpaper_combo->set_model(*GUI::ItemListModel<AK::String>::create(m_wallpapers)); m_wallpaper_combo->on_change = [this](auto& text, const GUI::ModelIndex& index) { String path = text; - if (m_monitor_widget->set_wallpaper(path)) { + if (path.starts_with("/") && m_monitor_widget->set_wallpaper(path)) { m_monitor_widget->update(); return; } |