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/app.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/app.c')
-rw-r--r-- | src/app.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -820,6 +820,11 @@ iLocalDef iBool isWaitingAllowed_App_(iApp *d) { | |||
820 | return iFalse; | 820 | return iFalse; |
821 | } | 821 | } |
822 | #endif | 822 | #endif |
823 | #if defined (iPlatformMobile) | ||
824 | if (!isFinished_Anim(&d->window->rootOffset)) { | ||
825 | return iFalse; | ||
826 | } | ||
827 | #endif | ||
823 | return !value_Atomic(&d->pendingRefresh) && isEmpty_SortedArray(&d->tickers); | 828 | return !value_Atomic(&d->pendingRefresh) && isEmpty_SortedArray(&d->tickers); |
824 | } | 829 | } |
825 | 830 | ||
@@ -929,7 +934,7 @@ void processEvents_App(enum iAppEventMode eventMode) { | |||
929 | } | 934 | } |
930 | } | 935 | } |
931 | #if defined (LAGRANGE_IDLE_SLEEP) | 936 | #if defined (LAGRANGE_IDLE_SLEEP) |
932 | if (d->isIdling && !gotEvents) { | 937 | if (d->isIdling && !gotEvents && isFinished_Anim(&d->window->rootOffset)) { |
933 | /* This is where we spend most of our time when idle. 60 Hz still quite a lot but we | 938 | /* This is where we spend most of our time when idle. 60 Hz still quite a lot but we |
934 | can't wait too long after the user tries to interact again with the app. In any | 939 | can't wait too long after the user tries to interact again with the app. In any |
935 | case, on macOS SDL_WaitEvent() seems to use 10x more CPU time than sleeping. */ | 940 | case, on macOS SDL_WaitEvent() seems to use 10x more CPU time than sleeping. */ |
@@ -1135,8 +1140,7 @@ iMimeHooks *mimeHooks_App(void) { | |||
1135 | } | 1140 | } |
1136 | 1141 | ||
1137 | iBool isLandscape_App(void) { | 1142 | iBool isLandscape_App(void) { |
1138 | const iApp *d = &app_; | 1143 | const iInt2 size = rootSize_Window(get_Window()); |
1139 | const iInt2 size = rootSize_Window(d->window); | ||
1140 | return size.x > size.y; | 1144 | return size.x > size.y; |
1141 | } | 1145 | } |
1142 | 1146 | ||
@@ -1700,6 +1704,7 @@ iBool handleCommand_App(const char *cmd) { | |||
1700 | #if defined (iPlatformAppleMobile) | 1704 | #if defined (iPlatformAppleMobile) |
1701 | /* Can't close the last on mobile. */ | 1705 | /* Can't close the last on mobile. */ |
1702 | if (tabCount_Widget(tabs) == 1) { | 1706 | if (tabCount_Widget(tabs) == 1) { |
1707 | postCommand_App("navigate.home"); | ||
1703 | return iTrue; | 1708 | return iTrue; |
1704 | } | 1709 | } |
1705 | #endif | 1710 | #endif |