From 75512175ba9da1c18ae36cfbb2b644a282f42c5c Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Thu, 30 Jul 2020 16:33:31 +0300 Subject: DocumentWidget: Indicate ongoing media requests --- src/ui/documentwidget.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 4e53ba44..7687ec16 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -773,6 +773,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e } } } + refresh_Widget(w); } else { postCommandf_App("open url:%s", @@ -873,6 +874,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { /* TODO: Show status of an ongoing media request. */ const int flags = linkFlags_GmDocument(doc, run->linkId); const iRect linkRect = moved_Rect(run->visBounds, origin); + iMediaRequest *mr = NULL; if (flags & content_GmLinkFlag) { fg = linkColor_GmDocument(doc, run->linkId); if (!isEmpty_Rect(run->bounds)) { @@ -894,6 +896,15 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { deinit_String(&text); } } + else if (run->flags & endOfLine_GmRunFlag && + (mr = findMediaRequest_DocumentWidget_(d->widget, run->linkId)) != NULL) { + if (!isFinished_GmRequest(mr->req)) { + draw_Text(default_FontId, + topRight_Rect(linkRect), + linkColor_GmDocument(doc, run->linkId), + " \u2014 Fetching\u2026"); + } + } else if (isHover) { const iGmLinkId linkId = d->widget->hoverLink->linkId; const iString * url = linkUrl_GmDocument(doc, linkId); -- cgit v1.2.3