diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-08 15:03:49 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-08 15:03:49 +0300 |
commit | 95ceeeddd59ec8ea95a14fb203b5a789dcc2a5b8 (patch) | |
tree | a2224441f98e4aae5d86cc98dd20fc9fb841072a /src | |
parent | 66fe7a034764a5c039d130e743b739c46a439043 (diff) |
Mobile: Sidebar on orientation change; padding
Sidebar is hidden on orientation changes. Added a bottom padding to account for the overlapped toolbar.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/sidebarwidget.c | 7 | ||||
-rw-r--r-- | src/ui/window.c | 14 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 74784547..6e379cb8 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -826,6 +826,13 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
826 | /* Handle commands. */ | 826 | /* Handle commands. */ |
827 | if (isResize_UserEvent(ev)) { | 827 | if (isResize_UserEvent(ev)) { |
828 | checkModeButtonLayout_SidebarWidget_(d); | 828 | checkModeButtonLayout_SidebarWidget_(d); |
829 | if (deviceType_App() == phone_AppDeviceType && d->side == left_SideBarSide) { | ||
830 | /* In landscape, visibility of the toolbar is controlled separately. */ | ||
831 | if (isVisible_Widget(w)) { | ||
832 | postCommand_Widget(w, "sidebar.toggle"); | ||
833 | } | ||
834 | return iFalse; | ||
835 | } | ||
829 | } | 836 | } |
830 | else if (isMetricsChange_UserEvent(ev)) { | 837 | else if (isMetricsChange_UserEvent(ev)) { |
831 | if (isVisible_Widget(w)) { | 838 | if (isVisible_Widget(w)) { |
diff --git a/src/ui/window.c b/src/ui/window.c index 4607b44c..a85c8a29 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -498,15 +498,21 @@ static void checkLoadAnimation_Window_(iWindow *d) { | |||
498 | 498 | ||
499 | static void updatePadding_Window_(iWindow *d) { | 499 | static void updatePadding_Window_(iWindow *d) { |
500 | #if defined (iPlatformAppleMobile) | 500 | #if defined (iPlatformAppleMobile) |
501 | iWidget *toolBar = findChild_Widget(d->root, "toolbar"); | ||
502 | float left, top, right, bottom; | ||
503 | safeAreaInsets_iOS(&left, &top, &right, &bottom); | ||
501 | /* Respect the safe area insets. */ { | 504 | /* Respect the safe area insets. */ { |
502 | float left, top, right, bottom; | ||
503 | safeAreaInsets_iOS(&left, &top, &right, &bottom); | ||
504 | setPadding_Widget(findChild_Widget(d->root, "navdiv"), left, top, right, 0); | 505 | setPadding_Widget(findChild_Widget(d->root, "navdiv"), left, top, right, 0); |
505 | iWidget *toolBar = findChild_Widget(d->root, "toolbar"); | ||
506 | if (toolBar) { | 506 | if (toolBar) { |
507 | setPadding_Widget(toolBar, left, 0, right, bottom); | 507 | setPadding_Widget(toolBar, left, 0, right, bottom); |
508 | } | 508 | } |
509 | } | 509 | } |
510 | if (toolBar) { | ||
511 | iWidget *sidebar = findChild_Widget(d->root, "sidebar"); | ||
512 | setPadding_Widget(sidebar, 0, 0, 0, isPortrait_App() ? 11 * gap_UI + bottom : 0); | ||
513 | /* TODO: There seems to be unrelated layout glitch in the sidebar where its children | ||
514 | are not arranged correctly until it's hidden and reshown. */ | ||
515 | } | ||
510 | /* Note that `handleNavBarCommands_` also adjusts padding and spacing. */ | 516 | /* Note that `handleNavBarCommands_` also adjusts padding and spacing. */ |
511 | #endif | 517 | #endif |
512 | } | 518 | } |
@@ -1253,6 +1259,7 @@ static void updateRootSize_Window_(iWindow *d, iBool notifyAlways) { | |||
1253 | size->y -= d->keyboardHeight; | 1259 | size->y -= d->keyboardHeight; |
1254 | d->root->minSize = *size; | 1260 | d->root->minSize = *size; |
1255 | if (notifyAlways || !isEqual_I2(oldSize, *size)) { | 1261 | if (notifyAlways || !isEqual_I2(oldSize, *size)) { |
1262 | updatePadding_Window_(d); | ||
1256 | const iBool isHoriz = (d->place.lastNotifiedSize.x != size->x); | 1263 | const iBool isHoriz = (d->place.lastNotifiedSize.x != size->x); |
1257 | const iBool isVert = (d->place.lastNotifiedSize.y != size->y); | 1264 | const iBool isVert = (d->place.lastNotifiedSize.y != size->y); |
1258 | arrange_Widget(d->root); | 1265 | arrange_Widget(d->root); |
@@ -1903,7 +1910,6 @@ void draw_Window(iWindow *d) { | |||
1903 | iInt2 renderSize; | 1910 | iInt2 renderSize; |
1904 | SDL_GetRendererOutputSize(d->render, &renderSize.x, &renderSize.y); | 1911 | SDL_GetRendererOutputSize(d->render, &renderSize.x, &renderSize.y); |
1905 | if (!isEqual_I2(renderSize, d->root->rect.size)) { | 1912 | if (!isEqual_I2(renderSize, d->root->rect.size)) { |
1906 | updatePadding_Window_(d); | ||
1907 | updateRootSize_Window_(d, iTrue); | 1913 | updateRootSize_Window_(d, iTrue); |
1908 | processEvents_App(postedEventsOnly_AppEventMode); | 1914 | processEvents_App(postedEventsOnly_AppEventMode); |
1909 | } | 1915 | } |