diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-06 14:44:17 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-06 14:44:17 +0200 |
commit | eddc86b7b0795fe7c7a82d86f6ee151ccdca229f (patch) | |
tree | 7eea8ac70aa37d068adfc2d06dc066367a10572c /src/ui/widget.c | |
parent | 7fa64b95d0c63b243f50b23c5551a7e04fe90c30 (diff) |
Mobile: Dealing with keyboard height
The software keyboard obstructs part of the UI, so need to offset the view if the focused input widget would not be visible.
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r-- | src/ui/widget.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index c54ea444..2381548a 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -507,6 +507,9 @@ iRect bounds_Widget(const iWidget *d) { | |||
507 | } | 507 | } |
508 | addv_I2(&bounds.pos, pos); | 508 | addv_I2(&bounds.pos, pos); |
509 | } | 509 | } |
510 | #if defined (iPlatformMobile) | ||
511 | bounds.pos.y += value_Anim(&get_Window()->rootOffset); | ||
512 | #endif | ||
510 | return bounds; | 513 | return bounds; |
511 | } | 514 | } |
512 | 515 | ||
@@ -1131,6 +1134,19 @@ static void printTree_Widget_(const iWidget *d, int indent) { | |||
1131 | } | 1134 | } |
1132 | } | 1135 | } |
1133 | 1136 | ||
1137 | iBool hasVisibleChildOnTop_Widget(const iWidget *parent) { | ||
1138 | iConstForEach(ObjectList, i, parent->children) { | ||
1139 | const iWidget *child = i.object; | ||
1140 | if (~child->flags & hidden_WidgetFlag && child->flags & keepOnTop_WidgetFlag) { | ||
1141 | return iTrue; | ||
1142 | } | ||
1143 | if (hasVisibleChildOnTop_Widget(child)) { | ||
1144 | return iTrue; | ||
1145 | } | ||
1146 | } | ||
1147 | return iFalse; | ||
1148 | } | ||
1149 | |||
1134 | void printTree_Widget(const iWidget *d) { | 1150 | void printTree_Widget(const iWidget *d) { |
1135 | printTree_Widget_(d, 0); | 1151 | printTree_Widget_(d, 0); |
1136 | } | 1152 | } |