diff options
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 4cd0ac18..030a323b 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -148,6 +148,7 @@ static void fetch_DocumentWidget_(iDocumentWidget *d) { | |||
148 | iRelease(d->request); | 148 | iRelease(d->request); |
149 | d->request = NULL; | 149 | d->request = NULL; |
150 | } | 150 | } |
151 | postCommand_Widget(as_Widget(d), "document.request.started"); | ||
151 | d->state = fetching_DocumentState; | 152 | d->state = fetching_DocumentState; |
152 | set_Atomic(&d->isSourcePending, iFalse); | 153 | set_Atomic(&d->isSourcePending, iFalse); |
153 | d->request = new_GmRequest(); | 154 | d->request = new_GmRequest(); |
@@ -171,6 +172,10 @@ void setUrl_DocumentWidget(iDocumentWidget *d, const iString *url) { | |||
171 | delete_String(newUrl); | 172 | delete_String(newUrl); |
172 | } | 173 | } |
173 | 174 | ||
175 | iBool isRequestOngoing_DocumentWidget(const iDocumentWidget *d) { | ||
176 | return d->state == fetching_DocumentState || d->state == receivedPartialResponse_DocumentState; | ||
177 | } | ||
178 | |||
174 | static void scroll_DocumentWidget_(iDocumentWidget *d, int offset) { | 179 | static void scroll_DocumentWidget_(iDocumentWidget *d, int offset) { |
175 | d->scrollY += offset; | 180 | d->scrollY += offset; |
176 | if (d->scrollY < 0) { | 181 | if (d->scrollY < 0) { |
@@ -278,6 +283,18 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
278 | postCommandf_App("document.changed url:%s", cstr_String(d->url)); | 283 | postCommandf_App("document.changed url:%s", cstr_String(d->url)); |
279 | return iTrue; | 284 | return iTrue; |
280 | } | 285 | } |
286 | else if (isCommand_UserEvent(ev, "document.stop")) { | ||
287 | if (d->request) { | ||
288 | postCommandf_App("document.request.cancelled url:%s", cstr_String(d->url)); | ||
289 | iReleasePtr(&d->request); | ||
290 | d->state = ready_DocumentState; | ||
291 | } | ||
292 | return iTrue; | ||
293 | } | ||
294 | else if (isCommand_UserEvent(ev, "document.reload")) { | ||
295 | fetch_DocumentWidget_(d); | ||
296 | return iTrue; | ||
297 | } | ||
281 | else if (isCommand_Widget(w, ev, "scroll.moved")) { | 298 | else if (isCommand_Widget(w, ev, "scroll.moved")) { |
282 | d->scrollY = arg_Command(command_UserEvent(ev)); | 299 | d->scrollY = arg_Command(command_UserEvent(ev)); |
283 | updateVisible_DocumentWidget_(d); | 300 | updateVisible_DocumentWidget_(d); |