diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-18 13:37:23 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-18 13:37:23 +0200 |
commit | 480fe2f859b191584113de6e483121d3893eaf3e (patch) | |
tree | 84c74f42b348ec8c6d6a81d7cca57e3c939cb6c8 /src/ui | |
parent | fa174461abdc5c33de16428109c7d46b4f150093 (diff) |
Mobile improvements
Seeing if a few forced redraws will take care of the squished view issue.
On the phone, showing and hiding the sidebar is not supposed to resize any documents.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 10 | ||||
-rw-r--r-- | src/ui/scrollwidget.c | 2 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 5 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 72867133..341da6f8 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1493,8 +1493,12 @@ static const int homeRowKeys_[] = { | |||
1493 | 't', 'y', | 1493 | 't', 'y', |
1494 | }; | 1494 | }; |
1495 | 1495 | ||
1496 | static void updateDocumentWidthRetainingScrollPosition_DocumentWidget_(iDocumentWidget *d, | 1496 | static iBool updateDocumentWidthRetainingScrollPosition_DocumentWidget_(iDocumentWidget *d, |
1497 | iBool keepCenter) { | 1497 | iBool keepCenter) { |
1498 | const int newWidth = documentWidth_DocumentWidget_(d); | ||
1499 | if (newWidth == size_GmDocument(d->doc).x) { | ||
1500 | return iFalse; /* hasn't changed */ | ||
1501 | } | ||
1498 | /* Font changes (i.e., zooming) will keep the view centered, otherwise keep the top | 1502 | /* Font changes (i.e., zooming) will keep the view centered, otherwise keep the top |
1499 | of the visible area fixed. */ | 1503 | of the visible area fixed. */ |
1500 | const iGmRun *run = keepCenter ? middleRun_DocumentWidget_(d) : d->firstVisibleRun; | 1504 | const iGmRun *run = keepCenter ? middleRun_DocumentWidget_(d) : d->firstVisibleRun; |
@@ -1505,7 +1509,7 @@ static void updateDocumentWidthRetainingScrollPosition_DocumentWidget_(iDocument | |||
1505 | /* TODO: First *fully* visible run? */ | 1509 | /* TODO: First *fully* visible run? */ |
1506 | voffset = visibleRange_DocumentWidget_(d).start - top_Rect(run->visBounds); | 1510 | voffset = visibleRange_DocumentWidget_(d).start - top_Rect(run->visBounds); |
1507 | } | 1511 | } |
1508 | setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d)); | 1512 | setWidth_GmDocument(d->doc, newWidth); |
1509 | documentRunsInvalidated_DocumentWidget_(d); | 1513 | documentRunsInvalidated_DocumentWidget_(d); |
1510 | if (runLoc && !keepCenter) { | 1514 | if (runLoc && !keepCenter) { |
1511 | run = findRunAtLoc_GmDocument(d->doc, runLoc); | 1515 | run = findRunAtLoc_GmDocument(d->doc, runLoc); |
diff --git a/src/ui/scrollwidget.c b/src/ui/scrollwidget.c index a08b58d7..050681f4 100644 --- a/src/ui/scrollwidget.c +++ b/src/ui/scrollwidget.c | |||
@@ -116,7 +116,7 @@ static void unfade_ScrollWidget_(iScrollWidget *d, float opacity) { | |||
116 | } | 116 | } |
117 | 117 | ||
118 | static void checkVisible_ScrollWidget_(iScrollWidget *d) { | 118 | static void checkVisible_ScrollWidget_(iScrollWidget *d) { |
119 | const iBool wasHidden = isVisible_Widget(d); | 119 | const iBool wasHidden = !isVisible_Widget(d); |
120 | const iBool isHidden = d->thumbSize != 0 ? height_Rect(thumbRect_ScrollWidget_(d)) == 0 : iTrue; | 120 | const iBool isHidden = d->thumbSize != 0 ? height_Rect(thumbRect_ScrollWidget_(d)) == 0 : iTrue; |
121 | setFlags_Widget(as_Widget(d), hidden_WidgetFlag, isHidden); | 121 | setFlags_Widget(as_Widget(d), hidden_WidgetFlag, isHidden); |
122 | if (wasHidden && !isHidden) { | 122 | if (wasHidden && !isHidden) { |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index ac119575..8c1bb60d 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -699,8 +699,9 @@ static void checkModeButtonLayout_SidebarWidget_(iSidebarWidget *d) { | |||
699 | } | 699 | } |
700 | 700 | ||
701 | void setWidth_SidebarWidget(iSidebarWidget *d, int width) { | 701 | void setWidth_SidebarWidget(iSidebarWidget *d, int width) { |
702 | const iBool isFixedWidth = deviceType_App() == phone_AppDeviceType; | ||
702 | iWidget *w = as_Widget(d); | 703 | iWidget *w = as_Widget(d); |
703 | if (deviceType_App() != phone_AppDeviceType) { /* phone doesn't allow resizing */ | 704 | if (!isFixedWidth) { |
704 | /* Even less space if the other sidebar is visible, too. */ | 705 | /* Even less space if the other sidebar is visible, too. */ |
705 | const int otherWidth = | 706 | const int otherWidth = |
706 | width_Widget(findWidget_App(d->side == left_SideBarSide ? "sidebar2" : "sidebar")); | 707 | width_Widget(findWidget_App(d->side == left_SideBarSide ? "sidebar2" : "sidebar")); |
@@ -713,7 +714,7 @@ void setWidth_SidebarWidget(iSidebarWidget *d, int width) { | |||
713 | arrange_Widget(findWidget_App("stack")); | 714 | arrange_Widget(findWidget_App("stack")); |
714 | checkModeButtonLayout_SidebarWidget_(d); | 715 | checkModeButtonLayout_SidebarWidget_(d); |
715 | updateItemHeight_SidebarWidget_(d); | 716 | updateItemHeight_SidebarWidget_(d); |
716 | if (!isRefreshPending_App()) { | 717 | if (!isFixedWidth && !isRefreshPending_App()) { |
717 | updateSize_DocumentWidget(document_App()); | 718 | updateSize_DocumentWidget(document_App()); |
718 | invalidate_ListWidget(d->list); | 719 | invalidate_ListWidget(d->list); |
719 | } | 720 | } |