From 1fc35259649d3f3206e0b28e51ca2e0ca7776d33 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Mon, 20 Dec 2021 06:33:53 +0200 Subject: Cleanup The "opened from sidebar" flag is unnecessary now. --- src/ui/documentwidget.c | 30 ++++++++---------------------- src/ui/documentwidget.h | 2 -- src/ui/sidebarwidget.c | 1 - 3 files changed, 8 insertions(+), 25 deletions(-) (limited to 'src/ui') diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 4af3dd72..3bd9f059 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -220,13 +220,12 @@ enum iDocumentWidgetFlag { movingSelectMarkEnd_DocumentWidgetFlag = iBit(11), otherRootByDefault_DocumentWidgetFlag = iBit(12), /* links open to other root by default */ urlChanged_DocumentWidgetFlag = iBit(13), - openedFromSidebar_DocumentWidgetFlag = iBit(14), - drawDownloadCounter_DocumentWidgetFlag = iBit(15), - fromCache_DocumentWidgetFlag = iBit(16), /* don't write anything to cache */ - animationPlaceholder_DocumentWidgetFlag = iBit(17), /* avoid slow operations */ - invalidationPending_DocumentWidgetFlag = iBit(18), /* invalidate as soon as convenient */ - leftWheelSwipe_DocumentWidgetFlag = iBit(19), /* swipe state flags are used on desktop */ - rightWheelSwipe_DocumentWidgetFlag = iBit(20), + drawDownloadCounter_DocumentWidgetFlag = iBit(14), + fromCache_DocumentWidgetFlag = iBit(15), /* don't write anything to cache */ + animationPlaceholder_DocumentWidgetFlag = iBit(16), /* avoid slow operations */ + invalidationPending_DocumentWidgetFlag = iBit(17), /* invalidate as soon as convenient */ + leftWheelSwipe_DocumentWidgetFlag = iBit(18), /* swipe state flags are used on desktop */ + rightWheelSwipe_DocumentWidgetFlag = iBit(19), eitherWheelSwipe_DocumentWidgetFlag = leftWheelSwipe_DocumentWidgetFlag | rightWheelSwipe_DocumentWidgetFlag, }; @@ -2144,9 +2143,7 @@ static void documentWasChanged_DocumentWidget_(iDocumentWidget *d) { } showOrHidePinningIndicator_DocumentWidget_(d); if (~d->flags & fromCache_DocumentWidgetFlag) { - setCachedDocument_History(d->mod.history, - d->view.doc, /* keeps a ref */ - (d->flags & openedFromSidebar_DocumentWidgetFlag) != 0); + setCachedDocument_History(d->mod.history, d->view.doc /* keeps a ref */); } } @@ -2905,14 +2902,11 @@ static void updateFromCachedResponse_DocumentWidget_(iDocumentWidget *d, float n static iBool updateFromHistory_DocumentWidget_(iDocumentWidget *d) { const iRecentUrl *recent = constMostRecentUrl_History(d->mod.history); if (recent && recent->cachedResponse && equalCase_String(&recent->url, d->mod.url)) { - iChangeFlags(d->flags, - openedFromSidebar_DocumentWidgetFlag, - recent->flags.openedFromSidebar); updateFromCachedResponse_DocumentWidget_( d, recent->normScrollY, recent->cachedResponse, recent->cachedDoc); if (!recent->cachedDoc) { /* We have a cached copy now. */ - setCachedDocument_History(d->mod.history, d->view.doc, iFalse); + setCachedDocument_History(d->mod.history, d->view.doc); } return iTrue; } @@ -5617,8 +5611,6 @@ void deserializeState_DocumentWidget(iDocumentWidget *d, iStream *ins) { } void setUrlFlags_DocumentWidget(iDocumentWidget *d, const iString *url, int setUrlFlags) { - iChangeFlags(d->flags, openedFromSidebar_DocumentWidgetFlag, - (setUrlFlags & openedFromSidebar_DocumentWidgetSetUrlFlag) != 0); const iBool allowCache = (setUrlFlags & useCachedContentIfAvailable_DocumentWidgetSetUrlFlag) != 0; setLinkNumberMode_DocumentWidget_(d, iFalse); setUrl_DocumentWidget_(d, urlFragmentStripped_String(url)); @@ -5631,7 +5623,6 @@ void setUrlFlags_DocumentWidget(iDocumentWidget *d, const iString *url, int setU void setUrlAndSource_DocumentWidget(iDocumentWidget *d, const iString *url, const iString *mime, const iBlock *source) { - d->flags &= ~openedFromSidebar_DocumentWidgetFlag; setLinkNumberMode_DocumentWidget_(d, iFalse); setUrl_DocumentWidget_(d, url); parseUser_DocumentWidget_(d); @@ -5673,11 +5664,6 @@ void setRedirectCount_DocumentWidget(iDocumentWidget *d, int count) { d->redirectCount = count; } -void setOpenedFromSidebar_DocumentWidget(iDocumentWidget *d, iBool fromSidebar) { - iChangeFlags(d->flags, openedFromSidebar_DocumentWidgetFlag, fromSidebar); -// setCachedDocument_History(d->mod.history, d->doc, fromSidebar); -} - iBool isRequestOngoing_DocumentWidget(const iDocumentWidget *d) { return d->request != NULL; } diff --git a/src/ui/documentwidget.h b/src/ui/documentwidget.h index 1405f19d..1bee8351 100644 --- a/src/ui/documentwidget.h +++ b/src/ui/documentwidget.h @@ -50,7 +50,6 @@ int documentWidth_DocumentWidget (const iDocumentWidget *); enum iDocumentWidgetSetUrlFlags { useCachedContentIfAvailable_DocumentWidgetSetUrlFlag = iBit(1), - openedFromSidebar_DocumentWidgetSetUrlFlag = iBit(2), }; void setOrigin_DocumentWidget (iDocumentWidget *, const iDocumentWidget *other); @@ -60,7 +59,6 @@ void setUrlAndSource_DocumentWidget (iDocumentWidget *, const iString *url, void setInitialScroll_DocumentWidget (iDocumentWidget *, float normScrollY); /* set after content received */ void setRedirectCount_DocumentWidget (iDocumentWidget *, int count); void setSource_DocumentWidget (iDocumentWidget *, const iString *sourceText); -void setOpenedFromSidebar_DocumentWidget(iDocumentWidget *, iBool fromSidebar); void takeRequest_DocumentWidget (iDocumentWidget *, iGmRequest *finishedRequest); /* ownership given */ diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 4b4968a3..fe8ec939 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c @@ -965,7 +965,6 @@ static void itemClicked_SidebarWidget_(iSidebarWidget *d, iSidebarItem *item, si const iGmHeading *head = constAt_Array(headings_GmDocument(doc), item->id); postCommandf_App("document.goto loc:%p", head->text.start); dismissPortraitPhoneSidebars_Root(as_Widget(d)->root); - setOpenedFromSidebar_DocumentWidget(document_App(), iTrue); } break; } -- cgit v1.2.3