diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-18 11:26:11 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-18 11:26:11 +0200 |
commit | fa174461abdc5c33de16428109c7d46b4f150093 (patch) | |
tree | 21cf16a2426f8a6b76195e1816ceea69778fbd70 /src/ui/widget.c | |
parent | 21f6248a3dc906a0c296b937dd1aa697784e6ea3 (diff) |
Scrollbar fading and periodic commands
Added a new mechanism to issue periodic but not per-frame commands. This is used for main-thread operations like checking if it's time to fade away the scrollbars.
Scrollbars are faded away completely on Apple platforms. Adjusted list right margins accordingly.
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r-- | src/ui/widget.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index d5e639fd..4f5d174c 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -582,10 +582,17 @@ iInt2 localCoord_Widget(const iWidget *d, iInt2 coord) { | |||
582 | } | 582 | } |
583 | 583 | ||
584 | iBool contains_Widget(const iWidget *d, iInt2 coord) { | 584 | iBool contains_Widget(const iWidget *d, iInt2 coord) { |
585 | const iRect bounds = { zero_I2(), addY_I2(d->rect.size, | 585 | return containsExpanded_Widget(d, coord, 0); |
586 | d->flags & drawBackgroundToBottom_WidgetFlag ? | 586 | } |
587 | rootSize_Window(get_Window()).y : 0) }; | 587 | |
588 | return contains_Rect(bounds, localCoord_Widget(d, coord)); | 588 | iBool containsExpanded_Widget(const iWidget *d, iInt2 coord, int expand) { |
589 | const iRect bounds = { | ||
590 | zero_I2(), | ||
591 | addY_I2(d->rect.size, | ||
592 | d->flags & drawBackgroundToBottom_WidgetFlag ? rootSize_Window(get_Window()).y : 0) | ||
593 | }; | ||
594 | return contains_Rect(expand ? expanded_Rect(bounds, init1_I2(expand)) : bounds, | ||
595 | localCoord_Widget(d, coord)); | ||
589 | } | 596 | } |
590 | 597 | ||
591 | iLocalDef iBool isKeyboardEvent_(const SDL_Event *ev) { | 598 | iLocalDef iBool isKeyboardEvent_(const SDL_Event *ev) { |
@@ -854,8 +861,8 @@ void drawBackground_Widget(const iWidget *d) { | |||
854 | const iBool isLight = isLight_ColorTheme(colorTheme_App()); | 861 | const iBool isLight = isLight_ColorTheme(colorTheme_App()); |
855 | p.alpha = isLight ? 0xc : 0x20; | 862 | p.alpha = isLight ? 0xc : 0x20; |
856 | SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND); | 863 | SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND); |
857 | iRect shadowRect = expanded_Rect(bounds_Widget(d), mulf_I2(gap2_UI, 1)); | 864 | iRect shadowRect = expanded_Rect(bounds_Widget(d), mulf_I2(gap2_UI, 8)); |
858 | shadowRect.pos.y += gap_UI / 4; | 865 | // shadowRect.pos.y += gap_UI * 4; |
859 | fillRect_Paint(&p, shadowRect, /*isLight ? white_ColorId :*/ black_ColorId); | 866 | fillRect_Paint(&p, shadowRect, /*isLight ? white_ColorId :*/ black_ColorId); |
860 | SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_NONE); | 867 | SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_NONE); |
861 | } | 868 | } |