Lagrange [work/v1.10]

Cleanup

=> 1fc35259649d3f3206e0b28e51ca2e0ca7776d33

diff --git a/src/app.c b/src/app.c
index 2590da0d..eea3689f 100644
--- a/src/app.c
+++ b/src/app.c
@@ -2780,8 +2780,7 @@ iBool handleCommand_App(const char *cmd) {
             urlEncodePath_String(url);
         }            
         setUrlFlags_DocumentWidget(doc, url,
-           (isHistory   ? useCachedContentIfAvailable_DocumentWidgetSetUrlFlag : 0) |
-           (fromSidebar ? openedFromSidebar_DocumentWidgetSetUrlFlag : 0));
+           isHistory ? useCachedContentIfAvailable_DocumentWidgetSetUrlFlag : 0);
         /* Optionally, jump to a text in the document. This will only work if the document
            is already available, e.g., it's from "about:" or restored from cache. */
         const iRangecc gotoHeading = range_Command(cmd, "gotoheading");
diff --git a/src/history.c b/src/history.c
index 91416020..837b38cb 100644
--- a/src/history.c
+++ b/src/history.c
@@ -37,7 +37,7 @@ void init_RecentUrl(iRecentUrl *d) {
     d->normScrollY    = 0;
     d->cachedResponse = NULL;
     d->cachedDoc      = NULL;
-    d->flags.openedFromSidebar = iFalse;
+    d->flags          = 0;
 }
 
 void deinit_RecentUrl(iRecentUrl *d) {
@@ -181,7 +181,7 @@ void serialize_History(const iHistory *d, iStream *outs) {
         const iRecentUrl *item = i.value;
         serialize_String(&item->url, outs);
         write32_Stream(outs, item->normScrollY * 1.0e6f);
-        writeU16_Stream(outs, item->flags.openedFromSidebar ? iBit(1) : 0);
+        writeU16_Stream(outs, item->flags);
         if (item->cachedResponse) {
             write8_Stream(outs, 1);
             serialize_GmResponse(item->cachedResponse, outs);
@@ -205,10 +205,7 @@ void deserialize_History(iHistory *d, iStream *ins) {
         set_String(&item.url, canonicalUrl_String(&item.url));
         item.normScrollY = (float) read32_Stream(ins) / 1.0e6f;
         if (version_Stream(ins) >= addedRecentUrlFlags_FileVersion) {
-            uint16_t flags = readU16_Stream(ins);
-            if (flags & iBit(1)) {
-                item.flags.openedFromSidebar = iTrue;
-            }
+            item.flags = readU16_Stream(ins);
         }
         if (read8_Stream(ins)) {
             item.cachedResponse = new_GmResponse();
@@ -409,7 +406,7 @@ void setCachedResponse_History(iHistory *d, const iGmResponse *response) {
     unlock_Mutex(d->mtx);
 }
 
-void setCachedDocument_History(iHistory *d, iGmDocument *doc, iBool openedFromSidebar) {
+void setCachedDocument_History(iHistory *d, iGmDocument *doc) {
     lock_Mutex(d->mtx);
     iRecentUrl *item = mostRecentUrl_History(d);
     iAssert(size_GmDocument(doc).x > 0);
@@ -421,7 +418,6 @@ void setCachedDocument_History(iHistory *d, iGmDocument *doc, iBool openedFromSi
                    cstr_String(url_GmDocument(doc)));
         }
 #endif
-        item->flags.openedFromSidebar = openedFromSidebar;
         if (item->cachedDoc != doc) {
             iRelease(item->cachedDoc);
             item->cachedDoc = ref_Object(doc);
diff --git a/src/history.h b/src/history.h
index bfb88cf4..383c132b 100644
--- a/src/history.h
+++ b/src/history.h
@@ -39,9 +39,7 @@ struct Impl_RecentUrl {
     float        normScrollY;    /* normalized to document height */
     iGmResponse *cachedResponse; /* kept in memory for quicker back navigation */
     iGmDocument *cachedDoc;      /* cached copy of the presentation: layout and media (not serialized) */
-    struct {
-        uint8_t openedFromSidebar : 1;
-    } flags;
+    uint16_t     flags;
 };
 
 iDeclareType(MemInfo)
@@ -65,7 +63,7 @@ void        clear_History               (iHistory *);
 void        add_History                 (iHistory *, const iString *url);
 void        replace_History             (iHistory *, const iString *url);
 void        setCachedResponse_History   (iHistory *, const iGmResponse *response);
-void        setCachedDocument_History   (iHistory *, iGmDocument *doc, iBool openedFromSidebar);
+void        setCachedDocument_History   (iHistory *, iGmDocument *doc);
 iBool       goBack_History              (iHistory *);
 iBool       goForward_History           (iHistory *);
 iRecentUrl *precedingLocked_History     (iHistory *); /* requires manual lock/unlock! */
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;
         }
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.10/cdiff/1fc35259649d3f3206e0b28e51ca2e0ca7776d33
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
65.354699 milliseconds
Gemini-to-HTML Time
0.439467 milliseconds

This content has been proxied by September (ba2dc).