Skip to content

Commit

Permalink
fix scroll on applist, some windows includes
Browse files Browse the repository at this point in the history
  • Loading branch information
vgmoose committed Dec 5, 2023
1 parent b634865 commit e028aa7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
9 changes: 2 additions & 7 deletions gui/AppDetailsContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,11 @@ bool AppDetailsContent::process(InputEvents* event)

int maxScrollOffset = screenshotsContainer.y + screenshotsContainer.height - SCREEN_HEIGHT + 100;

// make sure the max scroll offset is at least the screen height
if (maxScrollOffset < SCREEN_HEIGHT) {
// make sure the max scroll offset is positive and snap <50 to 0
if (maxScrollOffset < 50) {
maxScrollOffset = 0;
}

// if our screen scroll is too far down, stop the scroll
// printf("Screenshot container y: %d\n", screenshotsContainer.y);
// printf("Screenshot height: %d\n", screenshotsContainer.height);
// printf("Scroll offset: %d\n", this->y + this->yOff);

// if we're not touch dragging, and we're out of bounds, reset scroll bounds
if ((!event->isScrolling || event->isTouchUp()) && abs(this->y + this->yOff) > maxScrollOffset) {
this->y = -maxScrollOffset;
Expand Down
8 changes: 6 additions & 2 deletions gui/AppList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#endif

const char* AppList::sortingDescriptions[TOTAL_SORTS] = { "by most recent", "by download count", "alphabetically", "by size (descending)", "randomly" };

CST_Color AppList::red = { 0xff, 0, 0, 0xff };
CST_Color AppList::lighterRed = { 0xef, 0x48, 0x48, 0xff };

AppList::AppList(Get* get, Sidebar* sidebar)
: get(get) // the main get instance that contains repo info and stuff
Expand Down Expand Up @@ -80,6 +82,8 @@ AppList::AppList(Get* get, Sidebar* sidebar)
sortBlurb.setSize(15);
sortBlurb.setColor(HBAS::ThemeManager::textSecondary);

auto myRed = HBAS::ThemeManager::isDarkMode ? lighterRed : red;

#if defined(__WIIU__)
useBannerIcons = true;
#elif defined(SWITCH)
Expand All @@ -91,14 +95,14 @@ AppList::AppList(Get* get, Sidebar* sidebar)
if (!useBannerIcons) {
// applet mode, display a warning
nowPlayingText.setText("NOTICE: You are in Applet mode! Google \"Switch Applet Mode\" for more info.");
nowPlayingText.setColor(red);
nowPlayingText.setColor(myRed);
nowPlayingText.update();
}
#endif

#ifdef DEBUG_BUILD
nowPlayingText.setText("NOTICE: You are using a dev build! Update to a stable release if this is unintended.");
nowPlayingText.setColor(red);
nowPlayingText.setColor(myRed);
nowPlayingText.update();
#endif

Expand Down
2 changes: 1 addition & 1 deletion gui/AppList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class AppList : public ListElement
void keyboardInputCallback();

// the title of this category (from the sidebar)
static CST_Color black, gray, red;
static CST_Color black, gray, red, lighterRed;
static const char* sortingDescriptions[TOTAL_SORTS];

TextElement sortBlurb;
Expand Down
4 changes: 4 additions & 0 deletions gui/ThemeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include <switch.h>
#endif

#ifdef _WIN32
#include <windows.h>
#endif

namespace HBAS::ThemeManager
{
void themeManagerInit()
Expand Down
2 changes: 1 addition & 1 deletion libs/chesto
Submodule chesto updated 1 files
+6 −0 helpers/build_pc.sh
2 changes: 1 addition & 1 deletion libs/get
Submodule get updated 1 files
+5 −0 src/GetRepo.cpp

0 comments on commit e028aa7

Please sign in to comment.