diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-12-04 14:40:37 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-12-04 14:40:37 +0200 |
commit | f8c0c817c2ce1919f71ef333439c9f4742fc6a12 (patch) | |
tree | 99d6c51298029bafa87d195a6ece75bb735973c6 | |
parent | 2963641491200a6d67edd51af3b986af35faa04b (diff) |
ListWidget: Fixed touch scrolling issue
-rw-r--r-- | src/ui/listwidget.c | 5 | ||||
-rw-r--r-- | src/ui/listwidget.h | 1 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/src/ui/listwidget.c b/src/ui/listwidget.c index ccc5b104..1d0f1729 100644 --- a/src/ui/listwidget.c +++ b/src/ui/listwidget.c | |||
@@ -386,6 +386,8 @@ static iBool isScrollDisabled_ListWidget_(const iListWidget *d, const SDL_Event | |||
386 | dir = iSign(ev->wheel.y); | 386 | dir = iSign(ev->wheel.y); |
387 | } | 387 | } |
388 | switch (d->scrollMode) { | 388 | switch (d->scrollMode) { |
389 | case disabled_ScrollMode: | ||
390 | return iTrue; | ||
389 | case disabledAtTopBothDirections_ScrollMode: | 391 | case disabledAtTopBothDirections_ScrollMode: |
390 | return scrollPos_ListWidget(d) <= 0; | 392 | return scrollPos_ListWidget(d) <= 0; |
391 | case disabledAtTopUpwards_ScrollMode: | 393 | case disabledAtTopUpwards_ScrollMode: |
@@ -401,7 +403,8 @@ static iBool processEvent_ListWidget_(iListWidget *d, const SDL_Event *ev) { | |||
401 | if (isMetricsChange_UserEvent(ev)) { | 403 | if (isMetricsChange_UserEvent(ev)) { |
402 | invalidate_ListWidget(d); | 404 | invalidate_ListWidget(d); |
403 | } | 405 | } |
404 | else if (!isScrollDisabled_ListWidget_(d, ev) && processEvent_SmoothScroll(&d->scrollY, ev)) { | 406 | else if (!isScrollDisabled_ListWidget_(d, ev) && |
407 | processEvent_SmoothScroll(&d->scrollY, ev)) { | ||
405 | return iTrue; | 408 | return iTrue; |
406 | } | 409 | } |
407 | else if (isCommand_SDLEvent(ev)) { | 410 | else if (isCommand_SDLEvent(ev)) { |
diff --git a/src/ui/listwidget.h b/src/ui/listwidget.h index c5d412dd..da215b19 100644 --- a/src/ui/listwidget.h +++ b/src/ui/listwidget.h | |||
@@ -55,6 +55,7 @@ enum iScrollMode { | |||
55 | normal_ScrollMode, | 55 | normal_ScrollMode, |
56 | disabledAtTopBothDirections_ScrollMode, | 56 | disabledAtTopBothDirections_ScrollMode, |
57 | disabledAtTopUpwards_ScrollMode, | 57 | disabledAtTopUpwards_ScrollMode, |
58 | disabled_ScrollMode, | ||
58 | }; | 59 | }; |
59 | 60 | ||
60 | struct Impl_ListWidget { | 61 | struct Impl_ListWidget { |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 62abd58f..d91c85af 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -1812,7 +1812,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
1812 | w->rect.size.y = height_Rect(rootRect); | 1812 | w->rect.size.y = height_Rect(rootRect); |
1813 | } | 1813 | } |
1814 | else { | 1814 | else { |
1815 | setScrollMode_ListWidget(d->list, disabledAtTopBothDirections_ScrollMode); | 1815 | setScrollMode_ListWidget(d->list, disabled_ScrollMode); |
1816 | } | 1816 | } |
1817 | arrange_Widget(w); | 1817 | arrange_Widget(w); |
1818 | refresh_Widget(w); | 1818 | refresh_Widget(w); |