Fixed an issue where cursor callbacks were not always executed in CarouselComponent.

Also added an immediate return from onDemandTextureLoad() in the carousel and grid components if there are no entries.
This commit is contained in:
Leon Styhre 2023-03-05 17:51:16 +01:00
parent e96cbc52f9
commit f99552a458
2 changed files with 7 additions and 1 deletions

View file

@ -474,6 +474,9 @@ void CarouselComponent<T>::updateEntry(Entry& entry, const std::shared_ptr<Theme
template <typename T> void CarouselComponent<T>::onDemandTextureLoad() template <typename T> void CarouselComponent<T>::onDemandTextureLoad()
{ {
if constexpr (std::is_same_v<T, FileData*>) { if constexpr (std::is_same_v<T, FileData*>) {
if (size() == 0)
return;
if (mImageTypes.empty()) if (mImageTypes.empty())
mImageTypes.emplace_back("marquee"); mImageTypes.emplace_back("marquee");
@ -1981,7 +1984,7 @@ template <typename T> void CarouselComponent<T>::onCursorChanged(const CursorSta
GuiComponent::setAnimation(anim, 0, nullptr, false, 0); GuiComponent::setAnimation(anim, 0, nullptr, false, 0);
if (mCursorChangedCallback && !mEntries.empty()) if (mCursorChangedCallback)
mCursorChangedCallback(state); mCursorChangedCallback(state);
} }

View file

@ -410,6 +410,9 @@ void GridComponent<T>::updateEntry(Entry& entry, const std::shared_ptr<ThemeData
template <typename T> void GridComponent<T>::onDemandTextureLoad() template <typename T> void GridComponent<T>::onDemandTextureLoad()
{ {
if constexpr (std::is_same_v<T, FileData*>) { if constexpr (std::is_same_v<T, FileData*>) {
if (size() == 0)
return;
if (mImageTypes.empty()) if (mImageTypes.empty())
mImageTypes.emplace_back("marquee"); mImageTypes.emplace_back("marquee");