diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-24 19:27:32 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-24 19:27:32 +0200 |
commit | 95e6b3a344d5ef117cb16e7e89de39f53883ed3e (patch) | |
tree | 727f88bcf67f2b9d5ce4a228cb2cede0e06b93e4 /src/ui/widget.c | |
parent | d1756d31fb7c223a6428e79bd16e059100139626 (diff) |
Modal dialogs fade the background
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r-- | src/ui/widget.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index c1b95130..2bdda691 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -681,6 +681,26 @@ void drawBackground_Widget(const iWidget *d) { | |||
681 | iRect rect = bounds_Widget(d); | 681 | iRect rect = bounds_Widget(d); |
682 | iPaint p; | 682 | iPaint p; |
683 | init_Paint(&p); | 683 | init_Paint(&p); |
684 | if (d->flags & mouseModal_WidgetFlag) { | ||
685 | p.alpha = 128; | ||
686 | SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND); | ||
687 | int fadeColor; | ||
688 | switch (colorTheme_App()) { | ||
689 | default: | ||
690 | fadeColor = black_ColorId; | ||
691 | break; | ||
692 | case light_ColorTheme: | ||
693 | fadeColor = gray25_ColorId; | ||
694 | break; | ||
695 | case pureWhite_ColorTheme: | ||
696 | fadeColor = gray50_ColorId; | ||
697 | break; | ||
698 | } | ||
699 | fillRect_Paint(&p, | ||
700 | initCorners_Rect(zero_I2(), rootSize_Window(get_Window())), | ||
701 | fadeColor); | ||
702 | SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_NONE); | ||
703 | } | ||
684 | if (d->bgColor >= 0) { | 704 | if (d->bgColor >= 0) { |
685 | #if defined (iPlatformAppleMobile) | 705 | #if defined (iPlatformAppleMobile) |
686 | if (d->flags & (drawBackgroundToHorizontalSafeArea_WidgetFlag | | 706 | if (d->flags & (drawBackgroundToHorizontalSafeArea_WidgetFlag | |