diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-20 22:17:01 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-20 22:17:01 +0200 |
commit | 3b16b823d5840096402ec0bddc3d35f6028b75f6 (patch) | |
tree | f12049b85eed1afa9912e45d1911c7c1fb69c9fd /src/ui/sidebarwidget.c | |
parent | 1ca771a41e430f866e3a3270f285fc9a7eacfc65 (diff) |
Revising sidebar placement for phones
In portrait mode, phones have no room for sidebars so need to use a different widget arrangement.
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r-- | src/ui/sidebarwidget.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 456bcee7..da76c4d4 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -510,6 +510,9 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) { | |||
510 | resizeToParentHeight_WidgetFlag | | 510 | resizeToParentHeight_WidgetFlag | |
511 | (side == left_SideBarSide ? moveToParentRightEdge_WidgetFlag | 511 | (side == left_SideBarSide ? moveToParentRightEdge_WidgetFlag |
512 | : moveToParentLeftEdge_WidgetFlag)); | 512 | : moveToParentLeftEdge_WidgetFlag)); |
513 | if (deviceType_App() == phone_AppDeviceType) { | ||
514 | setFlags_Widget(d->resizer, hidden_WidgetFlag | disabled_WidgetFlag, iTrue); | ||
515 | } | ||
513 | setId_Widget(d->resizer, side == left_SideBarSide ? "sidebar.grab" : "sidebar2.grab"); | 516 | setId_Widget(d->resizer, side == left_SideBarSide ? "sidebar.grab" : "sidebar2.grab"); |
514 | d->resizer->rect.size.x = gap_UI; | 517 | d->resizer->rect.size.x = gap_UI; |
515 | setBackgroundColor_Widget(d->resizer, none_ColorId); | 518 | setBackgroundColor_Widget(d->resizer, none_ColorId); |
@@ -603,16 +606,18 @@ static void checkModeButtonLayout_SidebarWidget_(iSidebarWidget *d) { | |||
603 | } | 606 | } |
604 | 607 | ||
605 | void setWidth_SidebarWidget(iSidebarWidget *d, int width) { | 608 | void setWidth_SidebarWidget(iSidebarWidget *d, int width) { |
606 | iWidget * w = as_Widget(d); | 609 | iWidget *w = as_Widget(d); |
607 | /* Even less space if the other sidebar is visible, too. */ | 610 | if (deviceType_App() != phone_AppDeviceType) { /* phone doesn't allow resizing */ |
608 | const int otherWidth = | 611 | /* Even less space if the other sidebar is visible, too. */ |
609 | width_Widget(findWidget_App(d->side == left_SideBarSide ? "sidebar2" : "sidebar")); | 612 | const int otherWidth = |
610 | width = iClamp(width, 30 * gap_UI, rootSize_Window(get_Window()).x - 50 * gap_UI - otherWidth); | 613 | width_Widget(findWidget_App(d->side == left_SideBarSide ? "sidebar2" : "sidebar")); |
614 | width = iClamp(width, 30 * gap_UI, rootSize_Window(get_Window()).x - 50 * gap_UI - otherWidth); | ||
615 | } | ||
611 | d->width = width; | 616 | d->width = width; |
612 | if (isVisible_Widget(w)) { | 617 | if (isVisible_Widget(w)) { |
613 | w->rect.size.x = width; | 618 | w->rect.size.x = width; |
614 | } | 619 | } |
615 | arrange_Widget(findWidget_App("doctabs")); | 620 | arrange_Widget(findWidget_App("stack")); |
616 | checkModeButtonLayout_SidebarWidget_(d); | 621 | checkModeButtonLayout_SidebarWidget_(d); |
617 | if (!isRefreshPending_App()) { | 622 | if (!isRefreshPending_App()) { |
618 | updateSize_DocumentWidget(document_App()); | 623 | updateSize_DocumentWidget(document_App()); |