diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-12 13:49:38 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-12 13:49:38 +0300 |
commit | 33620846cca5678fbd662ea1a48fad302727dae7 (patch) | |
tree | 322fb4ab2c1dd7dd3eceee0834f3e90d27838de4 /src/ui/window.c | |
parent | 1410bbde7779efe3a20f603523547c8b8f55b6a1 (diff) |
Mobile: Draw optimizations; focus handling
Widgets can now be marked for buffering their contents, which is useful if their contents change seldom but they are drawn often.
For example, the navbar is always visible but doesn't change very often, and during animations menu contents are static but there is a moving animation so everything gets drawn 60 FPS.
Focus handling was also improved so the lookup results can be scrolled while entering text, and one can tap outside an input field to unfocus it.
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index 096853cc..3385f436 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -1060,12 +1060,13 @@ void draw_Window(iWindow *d) { | |||
1060 | d->frameTime = SDL_GetTicks(); | 1060 | d->frameTime = SDL_GetTicks(); |
1061 | if (isExposed_Window(d)) { | 1061 | if (isExposed_Window(d)) { |
1062 | d->isInvalidated = iFalse; | 1062 | d->isInvalidated = iFalse; |
1063 | extern int drawCount_; | ||
1063 | iForIndices(i, d->roots) { | 1064 | iForIndices(i, d->roots) { |
1064 | iRoot *root = d->roots[i]; | 1065 | iRoot *root = d->roots[i]; |
1065 | if (root) { | 1066 | if (root) { |
1066 | setCurrent_Root(root); | 1067 | setCurrent_Root(root); |
1067 | unsetClip_Paint(&p); /* update clip to current root */ | 1068 | unsetClip_Paint(&p); /* update clip to current root */ |
1068 | draw_Widget(root->widget); | 1069 | drawRoot_Widget(root->widget); |
1069 | #if defined (LAGRANGE_ENABLE_CUSTOM_FRAME) | 1070 | #if defined (LAGRANGE_ENABLE_CUSTOM_FRAME) |
1070 | /* App icon. */ | 1071 | /* App icon. */ |
1071 | const iWidget *appIcon = findChild_Widget(root->widget, "winbar.icon"); | 1072 | const iWidget *appIcon = findChild_Widget(root->widget, "winbar.icon"); |
@@ -1105,6 +1106,10 @@ void draw_Window(iWindow *d) { | |||
1105 | } | 1106 | } |
1106 | } | 1107 | } |
1107 | setCurrent_Root(NULL); | 1108 | setCurrent_Root(NULL); |
1109 | #if !defined (NDEBUG) | ||
1110 | draw_Text(defaultBold_FontId, zero_I2(), red_ColorId, "%d", drawCount_); | ||
1111 | drawCount_ = 0; | ||
1112 | #endif | ||
1108 | } | 1113 | } |
1109 | #if 0 | 1114 | #if 0 |
1110 | /* Text cache debugging. */ { | 1115 | /* Text cache debugging. */ { |