From 583e15e912f672fe7a70fc8c43781f5ed9672ea0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= jaakko.keranen@iki.fi
Date: Wed, 25 May 2022 14:55:38 +0300
Subject: [PATCH 1/1] Fixed issues with scrolling long popup windows
The visible root size must be clamped to the actual window size.
src/ui/root.c | 4 +++-
src/ui/widget.c | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/ui/root.c b/src/ui/root.c
index 6f2868b7..3906b6e6 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -2159,10 +2159,12 @@ iRect visibleRect_Root(const iRoot *d) {
visRect.size.y -= (int) (top + bottom);
#endif
#if defined (iPlatformDesktop)
/* Apply the usable bounds of the display. */
SDL_Rect usable;
/* TODO: Needs some investigation. With multiple monitors, at least on macOS, the bounds
returned here seem incorrect sometimes (infrequently). */
returned here seem incorrect sometimes (infrequently). */
if (iFalse) {
const float ratio = d->window->pixelRatio;
SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(d->window->win), &usable);
diff --git a/src/ui/widget.c b/src/ui/widget.c
index ef2ac868..d2ceb797 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -1289,7 +1289,7 @@ iBool scrollOverflow_Widget(iWidget *d, int delta) {
if (!isOverflowScrollPossible_Widget_(d, delta)) {
return iFalse;
}
const iRect winRect = visibleRect_Root(d->root);
/* TODO: This needs some fixing on mobile, probably. */
// const int yTop = iMaxi(0, top_Rect(winRect));
@@ -1393,7 +1393,7 @@ iBool processEvent_Widget(iWidget *d, const SDL_Event *ev) {
//SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(win->win),
// &usable);
const int bottomLimit =
/*iMin(*/ bottom_Rect(rect_Root(d->root)) /*, usable.h * win->pixelRatio) */
/*iMin(*/ bottom_Rect(visibleRect_Root(d->root)) /*, usable.h * win->pixelRatio) */
- hoverScrollLimit;
if (ev->motion.y > bottomLimit) {
speed = -(ev->motion.y - bottomLimit) / (float) hoverScrollLimit;
--
2.25.1
text/plain
This content has been proxied by September (3851b).