=> 2fa228e2ddc7151f99a9d039190ad5dc5ad785c1
[1mdiff --git a/src/app.c b/src/app.c[m [1mindex ed56d5b1..5f5791bf 100644[m [1m--- a/src/app.c[m [1m+++ b/src/app.c[m [36m@@ -171,6 +171,7 @@[m [mstruct Impl_App {[m unsigned int idleSleepDelayMs;[m #endif[m iAtomicInt pendingRefresh;[m [32m+[m[32m iBool disableRefresh;[m iBool isLoadingPrefs;[m iStringList *launchCommands;[m iBool isFinishedLaunching;[m [36m@@ -1067,6 +1068,10 @@[m [mstatic void dumpRequestFinished_App_(void *obj, iGmRequest *req) {[m unlock_Mutex(dumpMutex_);[m }[m [m [32m+[m[32mvoid disableRefresh_App(iBool dis) {[m [32m+[m[32m app_.disableRefresh = dis;[m [32m+[m[32m}[m [32m+[m static void init_App_(iApp *d, int argc, char **argv) {[m iBool doDump = iFalse;[m #if defined (iPlatformAndroid)[m [36m@@ -1081,6 +1086,7 @@[m [mstatic void init_App_(iApp *d, int argc, char **argv) {[m #endif[m d->isDarkSystemTheme = iTrue; /* will be updated by system later on, if supported */[m d->isSuspended = iFalse;[m [32m+[m[32m d->disableRefresh = iFalse;[m d->tempFilesPendingDeletion = new_StringSet();[m d->recentlyClosedTabUrls = new_StringList();[m d->overrideDataPath = NULL;[m [36m@@ -2252,6 +2258,9 @@[m [mstatic int run_App_(iApp *d) {[m [m void refresh_App(void) {[m iApp *d = &app_;[m [32m+[m[32m if (d->disableRefresh) {[m [32m+[m[32m return;[m [32m+[m[32m }[m #if defined (LAGRANGE_ENABLE_IDLE_SLEEP)[m if (d->warmupFrames == 0 && d->isIdling) {[m return;[m [36m@@ -4077,7 +4086,8 @@[m [miBool handleCommand_App(const char *cmd) {[m setUrlAndSource_DocumentWidget(page,[m collectNewCStr_String(""),[m collectNewCStr_String("text/gemini"),[m [31m- utf8_String(src));[m [32m+[m[32m utf8_String(src),[m [32m+[m[32m 0);[m return iTrue;[m }[m else if (equal_Command(cmd, "zoom.set")) {[m [36m@@ -4623,7 +4633,8 @@[m [miBool handleCommand_App(const char *cmd) {[m expTab,[m collect_String(format_Date(&now, "file:Lagrange User Data %Y-%m-%d %H%M%S.zip")),[m collectNewCStr_String("application/zip"),[m [31m- data_Buffer(zip));[m [32m+[m[32m data_Buffer(zip),[m [32m+[m[32m 0);[m iRelease(zip);[m delete_Export(export);[m #if defined (iPlatformAppleMobile) || defined (iPlatformAndroidMobile)[m [1mdiff --git a/src/app.h b/src/app.h[m [1mindex 48411791..7db9cf6e 100644[m [1m--- a/src/app.h[m [1m+++ b/src/app.h[m [36m@@ -89,6 +89,7 @@[m [mvoid refresh_App (void);[m iBool isRefreshPending_App (void);[m iBool isFinishedLaunching_App (void);[m uint32_t elapsedSinceLastTicker_App (void); /* milliseconds */[m [32m+[m[32mvoid disableRefresh_App (iBool);[m [m iBool isLandscape_App (void);[m iLocalDef iBool isPortrait_App (void) { return !isLandscape_App(); }[m [1mdiff --git a/src/ui/certlistwidget.c b/src/ui/certlistwidget.c[m [1mindex a97b7f15..f3bac75a 100644[m [1m--- a/src/ui/certlistwidget.c[m [1m+++ b/src/ui/certlistwidget.c[m [36m@@ -231,7 +231,8 @@[m [mstatic iBool processEvent_CertListWidget_(iCertListWidget *d, const SDL_Event *e[m expTab,[m collectNewFormat_String("file:%s.pem", cstr_String(name_GmIdentity(ident))),[m collectNewCStr_String("text/plain"),[m [31m- utf8_String(pem));[m [32m+[m[32m utf8_String(pem),[m [32m+[m[32m 0);[m }[m return iTrue;[m }[m [1mdiff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c[m [1mindex 1be0b35c..6067e24f 100644[m [1m--- a/src/ui/documentwidget.c[m [1m+++ b/src/ui/documentwidget.c[m [36m@@ -538,11 +538,11 @@[m [mstatic iChar linkOrdinalChar_DocumentWidget_(const iDocumentWidget *d, size_t or[m /*----------------------------------------------------------------------------------------------*/[m [m void init_DocumentView(iDocumentView *d) {[m [31m- d->owner = NULL;[m [31m- d->doc = new_GmDocument();[m [31m- d->invalidRuns = new_PtrSet();[m [31m- d->drawBufs = new_DrawBufs();[m [31m- d->pageMargin = 5;[m [32m+[m[32m d->owner = NULL;[m [32m+[m[32m d->doc = new_GmDocument();[m [32m+[m[32m d->invalidRuns = new_PtrSet();[m [32m+[m[32m d->drawBufs = new_DrawBufs();[m [32m+[m[32m d->pageMargin = 5;[m d->hoverPre = NULL;[m d->hoverAltPre = NULL;[m d->hoverLink = NULL;[m [36m@@ -728,15 +728,6 @@[m [mstatic const iGmRun *lastVisibleLink_DocumentView_(const iDocumentView *d) {[m return NULL;[m }[m [m [31m-static float normScrollPos_DocumentView_(const iDocumentView *d) {[m [31m- const int docSize = pageHeight_DocumentView_(d);[m [31m- if (docSize) {[m [31m- float pos = pos_SmoothScroll(&d->scrollY) / (float) docSize;[m [31m- return iMax(pos, 0.0f);[m [31m- }[m [31m- return 0;[m [31m-}[m [31m-[m static int scrollMax_DocumentView_(const iDocumentView *d) {[m const iWidget *w = constAs_Widget(d->owner);[m int sm = pageHeight_DocumentView_(d) +[m [36m@@ -745,6 +736,15 @@[m [mstatic int scrollMax_DocumentView_(const iDocumentView *d) {[m return sm;[m }[m [m [32m+[m[32mstatic float normScrollPos_DocumentView_(const iDocumentView *d) {[m [32m+[m[32m const int height = pageHeight_DocumentView_(d);[m [32m+[m[32m if (height > 0) {[m [32m+[m[32m float pos = pos_SmoothScroll(&d->scrollY) / (float) height;[m [32m+[m[32m return iMax(pos, 0.0f);[m [32m+[m[32m }[m [32m+[m[32m return 0;[m [32m+[m[32m}[m [32m+[m static void invalidateLink_DocumentView_(iDocumentView *d, iGmLinkId id) {[m /* A link has multiple runs associated with it. */[m iConstForEach(PtrArray, i, &d->visibleLinks) {[m [36m@@ -949,9 +949,11 @@[m [mstatic void updateVisible_DocumentView_(iDocumentView *d) {[m updateHover_DocumentView_(d, mouseCoord_Window(get_Window(), 0));[m updateSideOpacity_DocumentView_(d, iTrue);[m animateMedia_DocumentWidget_(d->owner);[m [31m- /* Remember scroll positions of recently visited pages. */ {[m [32m+[m[32m /* Remember scroll positions of recently visited pages. */[m [32m+[m[32m if (~d->owner->flags & animationPlaceholder_DocumentWidgetFlag) {[m [32m+[m[32m iAssert(~d->owner->widget.flags & destroyPending_WidgetFlag);[m iRecentUrl *recent = mostRecentUrl_History(d->owner->mod.history);[m [31m- if (recent && docSize && d->owner->state == ready_RequestState &&[m [32m+[m[32m if (recent && size_GmDocument(d->doc).y > 0 && d->owner->state == ready_RequestState &&[m equal_String(&recent->url, d->owner->mod.url)) {[m recent->normScrollY = normScrollPos_DocumentView_(d);[m }[m [36m@@ -3933,6 +3935,10 @@[m [mstatic iBool handleSwipe_DocumentWidget_(iDocumentWidget *d, const char *cmd) {[m [m 2022-03-16: Yeah, something did break, again. "swipeout" is not found if the tab bar[m is moved to the bottom, when swiping back.[m [32m+[m [32m+[m[32m 2023-02-03: There is a visual glitch because a refresh occurs during the switchover[m [32m+[m[32m of the document and its swipe placeholder. Solution is to forcibly prevent refresh from[m [32m+[m[32m occuring during the switch operation.[m */[m iWidget *w = as_Widget(d);[m if (!prefs_App()->edgeSwipe &&[m [36m@@ -3997,9 +4003,11 @@[m [mstatic iBool handleSwipe_DocumentWidget_(iDocumentWidget *d, const char *cmd) {[m updateBanner_DocumentWidget_(swipeIn);[m }[m else {[m [31m- setUrlAndSource_DocumentWidget(swipeIn, &recent->url,[m [32m+[m[32m setUrlAndSource_DocumentWidget(swipeIn,[m [32m+[m[32m &recent->url,[m collectNewCStr_String("text/gemini"),[m [31m- collect_Block(new_Block(0)));[m [32m+[m[32m collect_Block(new_Block(0)),[m [32m+[m[32m recent->normScrollY);[m }[m unlock_History(d->mod.history);[m }[m [36m@@ -4038,7 +4046,8 @@[m [mstatic iBool handleSwipe_DocumentWidget_(iDocumentWidget *d, const char *cmd) {[m setUrlAndSource_DocumentWidget(d,[m collectNewCStr_String("about:blank"),[m collectNewCStr_String("text/gemini"),[m [31m- collect_Block(new_Block(0)));[m [32m+[m[32m collect_Block(new_Block(0)),[m [32m+[m[32m 0);[m }[m if (flags_Widget(w) & dragged_WidgetFlag) {[m setVisualOffset_Widget(w, width_Widget(w) +[m [36m@@ -4075,13 +4084,21 @@[m [mstatic iBool handleSwipe_DocumentWidget_(iDocumentWidget *d, const char *cmd) {[m iAssert(~d->flags & animationPlaceholder_DocumentWidgetFlag);[m setFlags_Widget(w, dragged_WidgetFlag, iFalse);[m setVisualOffset_Widget(w, 0, 250, easeOut_AnimFlag | softer_AnimFlag);[m [32m+[m[32m stopWidgetMomentum_Touch(w);[m return iTrue;[m }[m if (equal_Command(cmd, "edgeswipe.ended") && argLabel_Command(cmd, "side") == 1) {[m [32m+[m[32m if (!argLabel_Command(cmd, "abort") && flags_Widget(w) & dragged_WidgetFlag) {[m [32m+[m[32m /* Hacky fix for animation glitches during swipe navigation, where the widgets get[m [32m+[m[32m refreshed in between the switch from swipeout/in and the real DocumentWidget.[m [32m+[m[32m GET RID OF THIS when the swipe animation is implemented in a more elegant way[m [32m+[m[32m (using DocumentViews). */[m [32m+[m[32m disableRefresh_App(iTrue);[m [32m+[m[32m }[m iWidget *swipeParent = swipeParent_DocumentWidget_(d);[m iDocumentWidget *swipeIn = findChild_Widget(swipeParent, "swipein");[m d->swipeSpeed = argLabel_Command(cmd, "speed") / gap_UI;[m [31m- /* "swipe.back" will soon follow. The `d` document will do the actual back navigation,[m [32m+[m[32m /* "swipe.back" may soon follow. The `d` document will do the actual back navigation,[m switching immediately to a cached page. However, if one is not available, we'll need[m to show a blank page for a while. */[m if (swipeIn) {[m [36m@@ -4098,11 +4115,13 @@[m [mstatic iBool handleSwipe_DocumentWidget_(iDocumentWidget *d, const char *cmd) {[m setUrlAndSource_DocumentWidget(d,[m swipeIn->mod.url,[m collectNewCStr_String("text/gemini"),[m [31m- collect_Block(new_Block(0)));[m [32m+[m[32m collect_Block(new_Block(0)),[m [32m+[m[32m 0);[m as_Widget(swipeIn)->offsetRef = NULL;[m }[m destroy_Widget(as_Widget(swipeIn));[m }[m [32m+[m[32m stopWidgetMomentum_Touch(w);[m }[m if (equal_Command(cmd, "swipe.back")) {[m iWidget *swipeParent = swipeParent_DocumentWidget_(d);[m [36m@@ -4112,6 +4131,7 @@[m [mstatic iBool handleSwipe_DocumentWidget_(iDocumentWidget *d, const char *cmd) {[m if (target) {[m destroy_Widget(as_Widget(target)); /* didn't need it after all */[m }[m [32m+[m[32m disableRefresh_App(iFalse);[m return iTrue;[m }[m setupSwipeOverlay_DocumentWidget_(d, as_Widget(target));[m [36m@@ -5084,8 +5104,11 @@[m [mstatic iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)[m }[m else if (equal_Command(cmd, "document.setmediatype") && document_App() == d) {[m if (!isRequestOngoing_DocumentWidget(d)) {[m [31m- setUrlAndSource_DocumentWidget(d, d->mod.url, string_Command(cmd, "mime"),[m [31m- &d->sourceContent);[m [32m+[m[32m setUrlAndSource_DocumentWidget(d,[m [32m+[m[32m d->mod.url,[m [32m+[m[32m string_Command(cmd, "mime"),[m [32m+[m[32m &d->sourceContent,[m [32m+[m[32m normScrollPos_DocumentView_(&d->view));[m }[m return iTrue;[m }[m [36m@@ -6546,6 +6569,10 @@[m [mvoid deserializeState_DocumentWidget(iDocumentWidget *d, iStream *ins) {[m void setUrlFlags_DocumentWidget(iDocumentWidget *d, const iString *url, int setUrlFlags,[m const iBlock *setIdent) {[m iAssert(~d->flags & animationPlaceholder_DocumentWidgetFlag);[m [32m+[m[32m /* Hacky fix for animation glitches during swipe navigation, where the widgets get refreshed[m [32m+[m[32m in between the switch from swipeout/in and the real DocumentWidget. GET RID OF THIS when[m [32m+[m[32m the swipe animation is implemented in a more elegant way (using DocumentViews). */[m [32m+[m[32m disableRefresh_App(iFalse);[m const iBool allowCache = (setUrlFlags & useCachedContentIfAvailable_DocumentWidgetSetUrlFlag) != 0;[m const iBool allowCachedDoc = (setUrlFlags & disallowCachedDocument_DocumentWidgetSetUrlFlag) == 0;[m iChangeFlags(d->flags, preventInlining_DocumentWidgetFlag,[m [36m@@ -6569,7 +6596,7 @@[m [mvoid setUrlFlags_DocumentWidget(iDocumentWidget *d, const iString *url, int setU[m }[m [m void setUrlAndSource_DocumentWidget(iDocumentWidget *d, const iString *url, const iString *mime,[m [31m- const iBlock *source) {[m [32m+[m[32m const iBlock *source, float normScrollY) {[m setLinkNumberMode_DocumentWidget_(d, iFalse);[m d->flags |= preventInlining_DocumentWidgetFlag;[m setUrl_DocumentWidget_(d, url);[m [36m@@ -6579,7 +6606,7 @@[m [mvoid setUrlAndSource_DocumentWidget(iDocumentWidget *d, const iString *url, cons[m initCurrent_Time(&resp->when);[m set_String(&resp->meta, mime);[m set_Block(&resp->body, source);[m [31m- updateFromCachedResponse_DocumentWidget_(d, 0, resp, NULL);[m [32m+[m[32m updateFromCachedResponse_DocumentWidget_(d, normScrollY, resp, NULL);[m updateBanner_DocumentWidget_(d);[m delete_GmResponse(resp);[m }[m [1mdiff --git a/src/ui/documentwidget.h b/src/ui/documentwidget.h[m [1mindex d734fda4..8071c759 100644[m [1m--- a/src/ui/documentwidget.h[m [1m+++ b/src/ui/documentwidget.h[m [36m@@ -67,7 +67,8 @@[m [mvoid setIdentity_DocumentWidget (iDocumentWidget *, const iBlock *setIde[m void setUrl_DocumentWidget (iDocumentWidget *, const iString *url);[m void setUrlFlags_DocumentWidget (iDocumentWidget *, const iString *url, int setUrlFlags,[m const iBlock *setIdent);[m [31m-void setUrlAndSource_DocumentWidget (iDocumentWidget *, const iString *url, const iString *mime, const iBlock *source);[m [32m+[m[32mvoid setUrlAndSource_DocumentWidget (iDocumentWidget *, const iString *url, const iString *mime,[m [32m+[m[32m const iBlock *source, float normScrollY);[m void setInitialScroll_DocumentWidget (iDocumentWidget *, float normScrollY); /* set after content received */[m void setRedirectCount_DocumentWidget (iDocumentWidget *, int count);[m void setSource_DocumentWidget (iDocumentWidget *, const iString *sourceText);[m [1mdiff --git a/src/ui/widget.c b/src/ui/widget.c[m [1mindex 4e5c43c3..f2caddec 100644[m [1m--- a/src/ui/widget.c[m [1m+++ b/src/ui/widget.c[m [36m@@ -147,8 +147,10 @@[m [mstatic void visualOffsetAnimation_Widget_(void *ptr) {[m iWidget *d = ptr;[m postRefresh_App();[m d->root->didAnimateVisualOffsets = iTrue;[m [31m-// printf("'%s' visoffanim: fin:%d val:%f\n", cstr_String(&d->id),[m [31m-// isFinished_Anim(&d->visualOffset), value_Anim(&d->visualOffset)); fflush(stdout);[m [32m+[m[32m#if 0[m [32m+[m[32m printf("'%s' visoffanim: fin:%d val:%f\n", cstr_String(&d->id),[m [32m+[m[32m isFinished_Anim(&d->visualOffset), value_Anim(&d->visualOffset)); fflush(stdout);[m [32m+[m[32m#endif[m if (!isFinished_Anim(&d->visualOffset)) {[m addTickerRoot_App(visualOffsetAnimation_Widget_, d->root, ptr);[m }[m
text/gemini; charset=utf-8
This content has been proxied by September (3851b).