HI Witold,

        Thanks for the patch. Much appreciated!

Nige

> On Mon, Sep 03, 2007 at 01:41:18PM +0100, [EMAIL PROTECTED] wrote:
>> Hi,
>>
>>      I would like to meta refresh one of two frames in elinks:
>>
>>              +-----+-----+
>>              |     |     |
>>              |  A  |  B  |
>>              |     |     |
>>              +-----+-----+
>>
>>      The frameset code is:
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
>> "http://www.w3.org/TR/html4/frameset.dtd";>
>> <html>
>> <HEAD>
>> <title>[EMAIL PROTECTED] - The Goo</title>
>> </HEAD>
>> <FRAMESET COLS="50%,*" style="background: url(http://thegoo.org/back.jpg)
>> no-repeat bottom center fixed">
>>       <!-- anchoring show perceptrons with# failed on elinks - caused
>> subsequent clicks to reload page -->
>>       <FRAME SRC="/show-perceptrons" name="left" width=400 height=400>
>>       <FRAME SRC="/todo" NAME="right" width=400 height=400>
>> </FRAMESET>
>> </html>
>>
>>      I would like to refresh the A frame in elinks using this HTML
>> (i.e., source of frame A):
>>
>>      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>      <html>
>>      <head>
>>      <meta http-equiv="content-type" content="text/html;
>> charset=iso-8859-1">
>>      <meta http-equiv="refresh" content="10;
>> URL=/show-perceptrons#bottom">
>>      <title></title>
>> <link rel="stylesheet" type="text/css" href="/goo.css" />
>>      </head>
>>
>>
>>      Elinks does no refreshing at all .... any ideas?
>
> Refreshing does not work for frames yet.
> This patch is an attempt on fixing this. (for 0.12.GIT)
>
> diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c
> index cba6fc1..f75600c 100644
> --- a/src/document/html/renderer.c
> +++ b/src/document/html/renderer.c
> @@ -2042,7 +2042,7 @@ html_special(struct html_context *html_context, enum 
> html_special_type c, ...)
>                       if (document) {
>                               if (document->refresh)
>                                       
> done_document_refresh(document->refresh);
> -                             document->refresh = init_document_refresh(t, 
> seconds);
> +                             document->refresh = init_document_refresh(t, 
> html_context->options->framename, seconds);
>                       }
>                       break;
>               }
> diff --git a/src/document/refresh.c b/src/document/refresh.c
> index eae40ca..46c9d0a 100644
> --- a/src/document/refresh.c
> +++ b/src/document/refresh.c
> @@ -26,7 +26,7 @@
>
>
> struct document_refresh *
> -init_document_refresh(unsigned char *url, unsigned long seconds)
> +init_document_refresh(unsigned char *url, unsigned char *framename, unsigned 
> long seconds)
> {
>       struct document_refresh *refresh;
>
> @@ -39,6 +39,7 @@ init_document_refresh(unsigned char *url, unsigned long 
> seconds)
>               return NULL;
>       }
>
> +     if (framename) refresh->frame = stracpy(framename);
>       refresh->seconds = seconds;
>       refresh->timer = TIMER_ID_UNDEF;
>       refresh->restart = 1;
> @@ -57,6 +58,7 @@ done_document_refresh(struct document_refresh *refresh)
> {
>       kill_document_refresh(refresh);
>       done_uri(refresh->uri);
> +     mem_free_if(refresh->frame);
>       mem_free(refresh);
> }
>
> @@ -66,8 +68,9 @@ done_document_refresh(struct document_refresh *refresh)
> static void
> do_document_refresh(void *data)
> {
> -     struct session *ses = data;
> -     struct document_refresh *refresh = ses->doc_view->document->refresh;
> +     struct document_view *doc_view = data;
> +     struct session *ses = doc_view->session;
> +     struct document_refresh *refresh = doc_view->document->refresh;
>       struct type_query *type_query;
>
>       assert(refresh);
> @@ -82,12 +85,12 @@ do_document_refresh(void *data)
>               if (compare_uri(refresh->uri, type_query->uri, URI_BASE))
>                       return;
>
> -     if (compare_uri(refresh->uri, ses->doc_view->document->uri, 0)) {
> +     if (compare_uri(refresh->uri, doc_view->document->uri, 0)) {
>               /* If the refreshing is for the current URI, force a reload. */
>               reload(ses, CACHE_MODE_FORCE_RELOAD);
>       } else {
>               /* This makes sure that we send referer. */
> -             goto_uri_frame(ses, refresh->uri, NULL, CACHE_MODE_NORMAL);
> +             goto_uri_frame(ses, refresh->uri, refresh->frame, 
> CACHE_MODE_NORMAL);
>               /* XXX: A possible very wrong work-around for refreshing used 
> when
>                * downloading files. */
>               refresh->restart = 0;
> @@ -95,12 +98,13 @@ do_document_refresh(void *data)
> }
>
> void
> -start_document_refresh(struct document_refresh *refresh, struct session *ses)
> +start_document_refresh(struct document_refresh *refresh, struct 
> document_view *doc_view)
> {
>       milliseconds_T minimum = (milliseconds_T) 
> get_opt_int("document.browse.minimum_refresh_time");
>       milliseconds_T refresh_delay = sec_to_ms(refresh->seconds);
>       milliseconds_T time = ms_max(refresh_delay, minimum);
>       struct type_query *type_query;
> +     struct session *ses = doc_view->session;
>
>       /* FIXME: This is just a work-around for stopping more than one timer
>        * from being started at anytime. The refresh timer should maybe belong
> @@ -118,5 +122,5 @@ start_document_refresh(struct document_refresh *refresh, 
> struct session *ses)
>               if (compare_uri(refresh->uri, type_query->uri, URI_BASE))
>                       return;
>
> -     install_timer(&refresh->timer, time, do_document_refresh, ses);
> +     install_timer(&refresh->timer, time, do_document_refresh, doc_view);
> }
> diff --git a/src/document/refresh.h b/src/document/refresh.h
> index f9b4c9c..03a9398 100644
> --- a/src/document/refresh.h
> +++ b/src/document/refresh.h
> @@ -3,19 +3,20 @@
>
> #include "main/timer.h" /* timer_id_T */
>
> -struct session;
> +struct document_view;
> struct uri;
>
> struct document_refresh {
>       timer_id_T timer;
>       unsigned long seconds;
>       struct uri *uri;
> +     unsigned char *frame;
>       unsigned int restart:1;
> };
>
> -struct document_refresh *init_document_refresh(unsigned char *url, unsigned 
> long seconds);
> +struct document_refresh *init_document_refresh(unsigned char *url, unsigned 
> char *frame, unsigned long seconds);
> void done_document_refresh(struct document_refresh *refresh);
> void kill_document_refresh(struct document_refresh *refresh);
> -void start_document_refresh(struct document_refresh *refresh, struct session 
> *ses);
> +void start_document_refresh(struct document_refresh *refresh, struct 
> document_view *doc_view);
>
> #endif
> diff --git a/src/session/session.c b/src/session/session.c
> index ae9f350..a5359d2 100644
> --- a/src/session/session.c
> +++ b/src/session/session.c
> @@ -571,6 +571,7 @@ doc_loading_callback(struct download *download, struct 
> session *ses)
>       int submit = 0;
>
>       if (is_in_result_state(download->state)) {
> +             struct document_view *dv;
> #ifdef CONFIG_SCRIPTING
>               maybe_pre_format_html(download->cached, ses);
> #endif
> @@ -590,12 +591,23 @@ doc_loading_callback(struct download *download, struct 
> session *ses)
>               load_ecmascript_imports(ses, ses->doc_view);
>               process_file_requests(ses);
>
> +             foreach (dv, ses->scrn_frames) {
> +                     assert(dv->document);
> +                     if (document_has_frames(dv->document)) continue;
> +                     if (dv->document->refresh && 
> get_opt_bool("document.browse.refresh")) {
> +                             assert(dv->document->cached);
> +                             if (!dv->document->cached->incomplete)
> +                                     
> start_document_refresh(dv->document->refresh, dv);
> +
> +                     }
> +             }
> +
>               if (ses->doc_view
>                   && ses->doc_view->document
>                   && ses->doc_view->document->refresh
>                   && get_opt_bool("document.browse.refresh")) {
>                       start_document_refresh(ses->doc_view->document->refresh,
> -                                            ses);
> +                                            ses->doc_view);
>               }
>
>               if (download->state != S_OK) {
> diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c
> index 6093315..49e33ac 100644
> --- a/src/viewer/text/draw.c
> +++ b/src/viewer/text/draw.c
> @@ -356,7 +356,7 @@ draw_formatted(struct session *ses, int rerender)
>                   && ses->doc_view->document->refresh
>                   && get_opt_bool("document.browse.refresh")) {
>                       start_document_refresh(ses->doc_view->document->refresh,
> -                                            ses);
> +                                            ses->doc_view);
>               }
>       }
>
> _______________________________________________
> elinks-users mailing list
> [email protected]
> http://linuxfromscratch.org/mailman/listinfo/elinks-users
>
_______________________________________________
elinks-users mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-users

Reply via email to