Changing settings now only invalidates the cached background when necessary.

This commit is contained in:
Leon Styhre 2021-03-21 18:46:45 +01:00
parent adc80ca3df
commit 84f4913610
4 changed files with 17 additions and 6 deletions

View file

@ -84,7 +84,6 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
setNeedsSaving();
setNeedsReloading();
setNeedsCollectionsUpdate();
setDoNotInvalidateCachedBackground();
}
});
@ -138,7 +137,6 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
setNeedsReloading();
setNeedsCollectionsUpdate();
setNeedsGoToGroupedCollections();
setDoNotInvalidateCachedBackground();
}
}
});
@ -293,6 +291,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
setNeedsReloading();
setNeedsSorting();
setNeedsSortingCollections();
setInvalidateCachedBackground();
}
});
@ -305,6 +304,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
Settings::getInstance()->setBool("FavStarCustom", fav_star_custom->getState());
setNeedsSaving();
setNeedsReloading();
setInvalidateCachedBackground();
}
});
@ -324,6 +324,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
setNeedsCollectionsUpdate();
setNeedsReloading();
setNeedsGoToSystem(SystemData::sSystemVector.front());
setInvalidateCachedBackground();
}
});
@ -339,6 +340,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
collection_show_system_info->getState());
setNeedsSaving();
setNeedsReloading();
setInvalidateCachedBackground();
}
});
}

View file

@ -148,6 +148,7 @@ void GuiMenu::openUISettings()
gamelist_view_style->getSelected());
s->setNeedsSaving();
s->setNeedsReloading();
s->setInvalidateCachedBackground();
}
});
@ -190,6 +191,7 @@ void GuiMenu::openUISettings()
Settings::getInstance()->setString("ThemeSet", theme_set->getSelected());
s->setNeedsSaving();
s->setNeedsReloading();
s->setInvalidateCachedBackground();
}
});
}
@ -273,6 +275,7 @@ void GuiMenu::openUISettings()
s->setNeedsResetFilters();
s->setNeedsReloading();
s->setNeedsGoToSystem(SystemData::sSystemVector.front());
s->setInvalidateCachedBackground();
}
});
@ -309,6 +312,7 @@ void GuiMenu::openUISettings()
s->setNeedsSaving();
s->setNeedsSorting();
s->setNeedsSortingCollections();
s->setInvalidateCachedBackground();
}
});
@ -343,6 +347,7 @@ void GuiMenu::openUISettings()
Settings::getInstance()->setBool("MenuBlurBackground",
menu_blur_background->getState());
s->setNeedsSaving();
s->setInvalidateCachedBackground();
}
});
#endif
@ -385,6 +390,7 @@ void GuiMenu::openUISettings()
Settings::getInstance()->setBool("FoldersOnTop", folders_on_top->getState());
s->setNeedsSaving();
s->setNeedsSorting();
s->setInvalidateCachedBackground();
}
});
@ -399,6 +405,7 @@ void GuiMenu::openUISettings()
s->setNeedsSaving();
s->setNeedsSorting();
s->setNeedsSortingCollections();
s->setInvalidateCachedBackground();
}
});
@ -411,6 +418,7 @@ void GuiMenu::openUISettings()
Settings::getInstance()->setBool("FavoritesStar", favorites_star->getState());
s->setNeedsSaving();
s->setNeedsReloading();
s->setInvalidateCachedBackground();
}
});
@ -940,6 +948,7 @@ void GuiMenu::openOtherSettings()
Settings::getInstance()->setBool("ROMDirGameMedia", rom_dir_game_media->getState());
s->setNeedsSaving();
s->setNeedsReloading();
s->setInvalidateCachedBackground();
}
});

View file

@ -33,7 +33,7 @@ GuiSettings::GuiSettings(
mNeedsGoToStart(false),
mNeedsGoToSystem(false),
mNeedsGoToGroupedCollections(false),
mDoNotInvalidateCachedBackground(false),
mInvalidateCachedBackground(false),
mGoToSystem(nullptr)
{
addChild(&mMenu);
@ -135,7 +135,7 @@ void GuiSettings::save()
}
}
if (!mDoNotInvalidateCachedBackground) {
if (mInvalidateCachedBackground) {
// This delay reduces the likelyhood that the SVG rasterizer which is running in a
// separate thread is not done until the cached background is invalidated. Without
// this delay there's a high chance that some theme elements are not rendered in

View file

@ -43,7 +43,7 @@ public:
void setNeedsGoToSystem(SystemData* goToSystem)
{ mNeedsGoToSystem = true; mGoToSystem = goToSystem; };
void setNeedsGoToGroupedCollections() { mNeedsGoToGroupedCollections = true; };
void setDoNotInvalidateCachedBackground() { mDoNotInvalidateCachedBackground = true; };
void setInvalidateCachedBackground() { mInvalidateCachedBackground = true; };
bool input(InputConfig* config, Input input) override;
std::vector<HelpPrompt> getHelpPrompts() override;
@ -61,7 +61,7 @@ private:
bool mNeedsGoToStart;
bool mNeedsGoToSystem;
bool mNeedsGoToGroupedCollections;
bool mDoNotInvalidateCachedBackground;
bool mInvalidateCachedBackground;
SystemData* mGoToSystem;
};