diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/bw.c | 11 | ||||
-rw-r--r-- | src/bw.h | 8 | ||||
-rw-r--r-- | src/cache.c | 2 | ||||
-rw-r--r-- | src/capi.c | 2 | ||||
-rw-r--r-- | src/html.cc | 35 | ||||
-rw-r--r-- | src/msg.h | 4 | ||||
-rw-r--r-- | src/nav.c | 161 | ||||
-rw-r--r-- | src/nav.h | 22 | ||||
-rw-r--r-- | src/plain.cc | 2 | ||||
-rw-r--r-- | src/uicmd.cc | 28 | ||||
-rw-r--r-- | src/uicmd.hh | 2 | ||||
-rw-r--r-- | src/web.cc | 12 |
13 files changed, 194 insertions, 97 deletions
@@ -31,6 +31,8 @@ dillo-fltk2 - Rewrote the DNS API and the Dpid start code inside Dillo. - Implemented Stop button to not only stop rendering but also networking. - Fixed the problem of scrolling position (remember position in a page). + - Implemented a new scheme of scroll-position remembering. This is one per + visited page intead of one per url (this is more standard). Patches: Jorge Arellano +- Connected signals to <li> elements (fixes links within lists). - Enabled text, background-color and geometry in preferences. @@ -50,10 +50,10 @@ BrowserWindow *a_Bw_new(int width, int height, uint32_t xid) bws[num_bws++] = bw; /* Initialize nav_stack */ - bw->nav_stack_size = 0; - bw->nav_stack_size_max = 16; - bw->nav_stack = NULL; + bw->nav_stack = dList_new(8); bw->nav_stack_ptr = -1; + + /* Init expect */ bw->nav_expecting = FALSE; bw->nav_expect_url = NULL; @@ -101,7 +101,10 @@ void a_Bw_free(BrowserWindow *bw) a_Url_free(dList_nth_data(bw->PageUrls, j)); dList_free(bw->PageUrls); - dFree(bw->nav_stack); + for (j = 0; j < dList_length(bw->nav_stack); ++j) + dFree(dList_nth_data(bw->nav_stack, j)); + dList_free(bw->nav_stack); + dStr_free(bw->page_bugs, 1); dFree(bw); break; @@ -39,14 +39,12 @@ struct _BrowserWindow Dlist *PageUrls; /* The navigation stack (holds indexes to history list) */ - int *nav_stack; - int nav_stack_size; /* [1 based] */ - int nav_stack_size_max; + Dlist *nav_stack; /* 'nav_stack_ptr' refers to what's being displayed */ - int nav_stack_ptr; /* [0 based] */ + int nav_stack_ptr; /* [0 based; -1 = empty] */ /* When the user clicks a link, the URL isn't pushed directly to history; * nav_expect_url holds it until the first answer-bytes are got. Only then - * it is sent to history and referenced in 'nav_stack[++nav_stack_ptr]' */ + * it is sent to history and referenced at the top of nav_stack */ DilloUrl *nav_expect_url; /* 'nav_expecting' is true if the last URL is being loaded for * the first time and has not gotten the dw yet. */ diff --git a/src/cache.c b/src/cache.c index efe7d0c1..511e3328 100644 --- a/src/cache.c +++ b/src/cache.c @@ -831,7 +831,7 @@ static void Cache_process_queue(CacheEntry_t *entry) /* Trigger cleanup when there're no cache clients */ if (dList_length(ClientQueue) == 0) { - MSG(" a_Dicache_cleanup()\n"); + _MSG(" a_Dicache_cleanup()\n"); a_Dicache_cleanup(); } @@ -216,7 +216,7 @@ static int Capi_dpi_verify_request(DilloWeb *web) (strchr(URL_STR(web->url), '?') || URL_DATA_(web->url))) { /* only allow dpi requests from dpi-generated urls */ if (a_Nav_stack_size(web->bw)) { - referer = a_History_get_url(NAV_TOP(web->bw)); + referer = a_History_get_url(NAV_TOP_UIDX(web->bw)); if (dStrcasecmp(URL_SCHEME(referer), "dpi") == 0) { allow = TRUE; } diff --git a/src/html.cc b/src/html.cc index c1f23bb2..9e790174 100644 --- a/src/html.cc +++ b/src/html.cc @@ -231,7 +231,7 @@ bool DilloHtmlLB::HtmlLinkReceiver::enter (Widget *widget, int link, { BrowserWindow *bw = this->lb->bw; - MSG(" ** "); + _MSG(" ** "); if (link == -1 && x == -1 && y == -1) { _MSG(" Link LEAVE notify...\n"); a_UIcmd_set_msg(bw, ""); @@ -537,7 +537,8 @@ static void Html_set_top_font(DilloHtml *html, const char *name, int size, * Evaluates the ALIGN attribute (left|center|right|justify) and * sets the style at the top of the stack. */ -static void Html_tag_set_align_attr(DilloHtml *html, const char *tag, int tagsize) +static void Html_tag_set_align_attr(DilloHtml *html, const char *tag, + int tagsize) { const char *align, *charattr; @@ -1034,7 +1035,8 @@ static char * /* * Parse spaces */ -static void Html_process_space(DilloHtml *html, const char *space, int spacesize) +static void Html_process_space(DilloHtml *html, const char *space, + int spacesize) { int i, offset; DilloHtmlParseMode parse_mode = S_TOP(html)->parse_mode; @@ -1592,7 +1594,7 @@ static void Html_tag_close_title(DilloHtml *html, int TagIdx) if (html->InFlags & IN_HEAD) { /* title is only valid inside HEAD */ a_UIcmd_set_page_title(html->linkblock->bw, html->Stash->str); - a_History_set_title(NAV_TOP(html->linkblock->bw), html->Stash->str); + a_History_set_title(NAV_TOP_UIDX(html->linkblock->bw),html->Stash->str); } else { MSG_HTML("the TITLE element must be inside the HEAD section\n"); } @@ -1829,7 +1831,8 @@ static void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) /* * used by <TD> and <TH> */ -static void Html_tag_open_table_cell(DilloHtml *html, const char *tag, int tagsize, +static void Html_tag_open_table_cell(DilloHtml *html, + const char *tag, int tagsize, TextAlignType text_align) { #ifdef USE_TABLES @@ -2091,7 +2094,8 @@ static void Html_tag_open_frame (DilloHtml *html, const char *tag, int tagsize) * todo: This is just a temporary fix while real frame support * isn't finished. Imitates lynx/w3m's frames. */ -static void Html_tag_open_frameset (DilloHtml *html, const char *tag, int tagsize) +static void Html_tag_open_frameset (DilloHtml *html, + const char *tag, int tagsize) { DW2TB(html->dw)->addParbreak (9, S_TOP(html)->style); DW2TB(html->dw)->addText(dStrdup("--FRAME--"), @@ -2134,7 +2138,8 @@ static void Html_tag_close_h(DilloHtml *html, int TagIdx) /* * <BIG> | <SMALL> */ -static void Html_tag_open_big_small(DilloHtml *html, const char *tag, int tagsize) +static void Html_tag_open_big_small(DilloHtml *html, + const char *tag, int tagsize) { int level; @@ -2343,7 +2348,8 @@ static void Html_tag_open_center(DilloHtml *html, const char *tag, int tagsize) /* * <ADDRESS> */ -static void Html_tag_open_address(DilloHtml *html, const char *tag, int tagsize) +static void Html_tag_open_address(DilloHtml *html, + const char *tag, int tagsize) { DW2TB(html->dw)->addParbreak (9, S_TOP(html)->style); Html_set_top_font(html, NULL, 0, 2, 2); @@ -2768,7 +2774,8 @@ static void Html_tag_open_strike(DilloHtml *html, const char *tag, int tagsize) /* * <BLOCKQUOTE> */ -static void Html_tag_open_blockquote(DilloHtml *html, const char *tag, int tagsize) +static void Html_tag_open_blockquote(DilloHtml *html, + const char *tag, int tagsize) { DW2TB(html->dw)->addParbreak (9, S_TOP(html)->style); Html_add_indented(html, 40, 40, 9); @@ -3074,8 +3081,8 @@ static void Html_tag_close_pre(DilloHtml *html, int TagIdx) */ static int Html_tag_pre_excludes(int tag_idx) { - const char *es_set[] = {"img", "object", "applet", "big", "small", "sub", "sup", - "font", "basefont", NULL}; + const char *es_set[] = {"img", "object", "applet", "big", "small", "sub", + "sup", "font", "basefont", NULL}; static int ei_set[10], i; /* initialize array */ @@ -3826,7 +3833,8 @@ static void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize) * The ISINDEX tag is just a deprecated form of <INPUT type=text> with * implied FORM, afaics. */ -static void Html_tag_open_isindex(DilloHtml *html, const char *tag, int tagsize) +static void Html_tag_open_isindex(DilloHtml *html, + const char *tag, int tagsize) { // // AL // DilloHtmlForm *form; @@ -3920,7 +3928,8 @@ static void Html_tag_close_textarea(DilloHtml *html, int TagIdx) * The textarea tag * (todo: It doesn't support wrapping). */ -static void Html_tag_open_textarea(DilloHtml *html, const char *tag, int tagsize) +static void Html_tag_open_textarea(DilloHtml *html, + const char *tag, int tagsize) { // // AL // DilloHtmlLB *html_lb; @@ -15,8 +15,10 @@ #define MSG(...) \ D_STMT_START { \ - if (prefs.show_msg) \ + if (prefs.show_msg){ \ printf(__VA_ARGS__); \ + fflush (stdout); \ + } \ } D_STMT_END #define MSG_WARN(...) \ @@ -34,6 +34,8 @@ static void Nav_reload(BrowserWindow *bw); /* * Free memory used by this module + * TODO: this may be removed or called by a_Bw_free(). + * Currently is not called from anywhere. */ void a_Nav_free(BrowserWindow *bw) { @@ -53,6 +55,26 @@ int a_Nav_stack_ptr(BrowserWindow *bw) } /* + * Return the url index of i-th element in the stack. [-1 = Error] + */ +int a_Nav_get_uidx(BrowserWindow *bw, int i) +{ + nav_stack_item *nsi = dList_nth_data (bw->nav_stack, i); + return (nsi) ? nsi->url_idx : -1; +} + +/* + * Return the url index of the top element in the stack. + */ +int a_Nav_get_top_uidx(BrowserWindow *bw) +{ + nav_stack_item *nsi; + + nsi = dList_nth_data (bw->nav_stack, a_Nav_stack_size(bw) - 1); + return (nsi) ? nsi->url_idx : -1; +} + +/* * Move the nav_stack pointer */ static void Nav_stack_move_ptr(BrowserWindow *bw, int offset) @@ -62,7 +84,7 @@ static void Nav_stack_move_ptr(BrowserWindow *bw, int offset) dReturn_if_fail (bw != NULL); if (offset != 0) { nptr = bw->nav_stack_ptr + offset; - dReturn_if_fail (nptr >= 0 && nptr < bw->nav_stack_size); + dReturn_if_fail (nptr >= 0 && nptr < a_Nav_stack_size(bw)); bw->nav_stack_ptr = nptr; } } @@ -72,39 +94,59 @@ static void Nav_stack_move_ptr(BrowserWindow *bw, int offset) */ int a_Nav_stack_size(BrowserWindow *bw) { - return bw->nav_stack_size; + return dList_length(bw->nav_stack); } /* - * Add an URL-index in the navigation stack. + * Add a nav_stack_item into the stack. + * If idx is not at the top, the stack is truncated at idx before adding. */ -static void Nav_stack_add(BrowserWindow *bw, int idx) +static void Nav_stack_add(BrowserWindow *bw, int url_idx, int posx, int posy) { + int j; + void *data; + nav_stack_item *nsi; + dReturn_if_fail (bw != NULL); - ++bw->nav_stack_ptr; - if (bw->nav_stack_ptr == bw->nav_stack_size) { - a_List_add(bw->nav_stack, bw->nav_stack_size, bw->nav_stack_size_max); - ++bw->nav_stack_size; - } else { - bw->nav_stack_size = bw->nav_stack_ptr + 1; + j = ++bw->nav_stack_ptr; + while (j < dList_length(bw->nav_stack)) { + data = dList_nth_data(bw->nav_stack, j); + dList_remove_fast (bw->nav_stack, data); } - bw->nav_stack[bw->nav_stack_ptr] = idx; + nsi = dNew(nav_stack_item, 1); + nsi->url_idx = url_idx; + nsi->posx = posx; + nsi->posy = posy; + dList_append (bw->nav_stack, nsi); } /* - * Remove an URL-index from the navigation stack. + * Get the scrolling position of the current page. */ -static void Nav_stack_remove(BrowserWindow *bw, int idx) +static void Nav_get_scroll_pos(BrowserWindow *bw, int *posx, int *posy) { - int sz = a_Nav_stack_size(bw); + nav_stack_item *nsi; + + if ((nsi = dList_nth_data (bw->nav_stack, a_Nav_stack_ptr(bw)))) { + *posx = nsi->posx; + *posy = nsi->posy; + } else { + *posx = *posy = 0; + } +} - dReturn_if_fail (bw != NULL && idx >=0 && idx < sz); +/* + * Set the scrolling position of the current page. + */ +static void Nav_set_scroll_pos(BrowserWindow *bw, int idx, int posx, int posy) +{ + nav_stack_item *nsi; - for ( ; idx < sz - 1; ++idx) - bw->nav_stack[idx] = bw->nav_stack[idx + 1]; - if (bw->nav_stack_ptr == --bw->nav_stack_size) - --bw->nav_stack_ptr; + if ((nsi = dList_nth_data (bw->nav_stack, idx))) { + nsi->posx = posx; + nsi->posy = posy; + } } /* @@ -118,8 +160,11 @@ static void Nav_stack_clean(BrowserWindow *bw) dReturn_if_fail (bw != NULL); if ((i = a_Nav_stack_size(bw)) >= 2 && - bw->nav_stack[i-2] == bw->nav_stack[i-1]) - Nav_stack_remove(bw, i - 1); + NAV_UIDX(bw,i - 2) == NAV_UIDX(bw,i -1)) { + void *data = dList_nth_data (bw->nav_stack, i - 1); + dList_remove_fast (bw->nav_stack, data); + dFree(data); + } } @@ -133,26 +178,23 @@ static void Nav_stack_clean(BrowserWindow *bw) */ static void Nav_open_url(BrowserWindow *bw, const DilloUrl *url, int offset) { - DilloUrl *old_url = NULL; + DilloUrl *old_url; bool_t MustLoad; - int x, y, ClientKey; + int x, y, idx, ClientKey; DilloWeb *Web; - char *loc_text; bool_t ForceReload = (URL_FLAGS(url) & URL_E2EReload); - MSG("Nav_open_url: Url=>%s<\n", URL_STR_(url)); + MSG("Nav_open_url: new url='%s'\n", URL_STR_(url)); /* Get the url of the current page */ - if (a_Nav_stack_ptr(bw) != -1) - old_url = a_History_get_url(NAV_TOP(bw)); - - /* Record current scrolling position - * (the strcmp check is necessary because of redirections) */ - loc_text = a_UIcmd_get_location_text(bw); - if (old_url && !strcmp(URL_STR(old_url), loc_text)) { + idx = a_Nav_stack_ptr(bw); + old_url = a_History_get_url(idx); + /* Record current scrolling position */ + if (old_url) { a_UIcmd_get_scroll_xy(bw, &x, &y); - _MSG("NAV: ScrollPosXY: x=%d y=%d\n",x,y); - a_Url_set_pos(old_url, x, y); + Nav_set_scroll_pos(bw, idx, x, y); + MSG("Nav_open_url: set scroll of '%s' to x=%d y=%d\n", + URL_STR(old_url), x, y); } /* Update navigation-stack-pointer (offset may be zero) */ @@ -164,7 +206,6 @@ static void Nav_open_url(BrowserWindow *bw, const DilloUrl *url, int offset) MustLoad |= (a_Url_cmp(old_url, url) != 0); MustLoad |= strcmp(URL_STR(old_url), a_UIcmd_get_location_text(bw)); } - dFree(loc_text); if (MustLoad) { a_Bw_stop_clients(bw, BW_Root + BW_Img); @@ -181,13 +222,13 @@ static void Nav_open_url(BrowserWindow *bw, const DilloUrl *url, int offset) } } - /* Jump to #anchor position */ - if (URL_FRAGMENT_(url)) { - /* todo: push on stack */ - char *pf = a_Url_decode_hex_str(URL_FRAGMENT_(url)); - //a_Dw_render_layout_set_anchor(bw->render_layout, pf); - dFree(pf); - } + // /* Jump to #anchor position */ + // if (URL_FRAGMENT_(url)) { + // /* todo: push on stack */ + // char *pf = a_Url_decode_hex_str(URL_FRAGMENT_(url)); + // //a_Dw_render_layout_set_anchor(bw->render_layout, pf); + // dFree(pf); + // } } /* @@ -210,8 +251,9 @@ void a_Nav_cancel_expect(BrowserWindow *bw) */ void a_Nav_expect_done(BrowserWindow *bw) { - int idx; + int url_idx, posx, posy; DilloUrl *url; + char *f; dReturn_if_fail(bw != NULL); @@ -219,15 +261,28 @@ void a_Nav_expect_done(BrowserWindow *bw) url = bw->nav_expect_url; /* unset E2EReload before adding this url to history */ a_Url_set_flags(url, URL_FLAGS(url) & ~URL_E2EReload); - idx = a_History_add_url(url); - Nav_stack_add(bw, idx); - + url_idx = a_History_add_url(url); + Nav_stack_add(bw, url_idx, 0, 0); + /* Scroll to the origin unless there's a fragment part */ + f = a_Url_decode_hex_str(URL_FRAGMENT_(url)); + if (!f) { + a_UIcmd_set_scroll_xy(bw, 0, 0); + } else { + a_UIcmd_set_scroll_by_fragment(bw, f); + dFree(f); + } a_Url_free(url); bw->nav_expect_url = NULL; bw->nav_expecting = FALSE; + } else { + /* Scroll to were we were in this page */ + Nav_get_scroll_pos(bw, &posx, &posy); + a_UIcmd_set_scroll_xy(bw, posx, posy); + MSG("Nav: expect_done scrolling to x=%d y=%d\n", posx, posy); } Nav_stack_clean(bw); a_UIcmd_set_buttons_sens(bw); + _MSG("Nav: a_Nav_expect_done\n"); } /* @@ -281,7 +336,7 @@ void a_Nav_back(BrowserWindow *bw) a_Nav_cancel_expect(bw); if (--idx >= 0){ a_UIcmd_set_msg(bw, ""); - Nav_open_url(bw, a_History_get_url(NAV_IDX(bw,idx)), -1); + Nav_open_url(bw, a_History_get_url(NAV_UIDX(bw,idx)), -1); } } @@ -295,7 +350,7 @@ void a_Nav_forw(BrowserWindow *bw) a_Nav_cancel_expect(bw); if (++idx < a_Nav_stack_size(bw)) { a_UIcmd_set_msg(bw, ""); - Nav_open_url(bw, a_History_get_url(NAV_IDX(bw,idx)), +1); + Nav_open_url(bw, a_History_get_url(NAV_UIDX(bw,idx)), +1); } } @@ -316,8 +371,8 @@ static void Nav_reload(BrowserWindow *bw) a_Nav_cancel_expect(bw); if (a_Nav_stack_size(bw)) { - url = a_History_get_url(NAV_TOP(bw)); - ReqURL = a_Url_dup(a_History_get_url(NAV_TOP(bw))); + url = a_History_get_url(NAV_TOP_UIDX(bw)); + ReqURL = a_Url_dup(a_History_get_url(NAV_TOP_UIDX(bw))); /* Let's make reload be end-to-end */ a_Url_set_flags(ReqURL, URL_FLAGS(ReqURL) | URL_E2EReload); /* This is an explicit reload, so clear the SpamSafe flag */ @@ -338,7 +393,7 @@ void a_Nav_reload(BrowserWindow *bw) a_Nav_cancel_expect(bw); if (a_Nav_stack_size(bw)) { - url = a_History_get_url(NAV_TOP(bw)); + url = a_History_get_url(NAV_TOP_UIDX(bw)); if (URL_FLAGS(url) & URL_Post) { /* Attempt to repost data, let's confirm... */ choice = a_Dialog_choice3("Repost form data?", @@ -362,10 +417,10 @@ void a_Nav_jump(BrowserWindow *bw, int offset, int new_bw) int idx = a_Nav_stack_ptr(bw) + offset; if (new_bw) { - a_Nav_push_nw(bw, a_History_get_url(NAV_IDX(bw,idx))); + a_Nav_push_nw(bw, a_History_get_url(NAV_UIDX(bw,idx))); } else { a_Nav_cancel_expect(bw); - Nav_open_url(bw, a_History_get_url(NAV_IDX(bw,idx)), offset); + Nav_open_url(bw, a_History_get_url(NAV_UIDX(bw,idx)), offset); a_UIcmd_set_buttons_sens(bw); } } @@ -3,10 +3,22 @@ #include "bw.h" - -/* useful macros for the navigation stack */ -#define NAV_IDX(bw, i) (bw)->nav_stack[i] -#define NAV_TOP(bw) (bw)->nav_stack[(bw)->nav_stack_ptr] +/* + * useful macros for the navigation stack + */ +#define NAV_UIDX(bw, i) a_Nav_get_uidx(bw, i) +#define NAV_TOP_UIDX(bw) a_Nav_get_top_uidx(bw) + +/* + * For back and forward navigation, each bw keeps an url index, + * and its scroll position. + */ +typedef struct _nav_stack_item nav_stack_item; +struct _nav_stack_item +{ + int url_idx; + int posx, posy; +}; #ifdef __cplusplus @@ -26,6 +38,8 @@ void a_Nav_cancel_expect (BrowserWindow *bw); void a_Nav_expect_done(BrowserWindow *bw); int a_Nav_stack_ptr(BrowserWindow *bw); int a_Nav_stack_size(BrowserWindow *bw); +int a_Nav_get_uidx(BrowserWindow *bw, int i); +int a_Nav_get_top_uidx(BrowserWindow *bw); void a_Nav_save_url(BrowserWindow *bw, const DilloUrl *url, const char *filename); diff --git a/src/plain.cc b/src/plain.cc index 1240716f..af73310e 100644 --- a/src/plain.cc +++ b/src/plain.cc @@ -73,7 +73,7 @@ static void Plain_callback(int Op, CacheClient_t *Client); // BrowserWindow *bw) //{ // if (event->button == 3) { -// a_Menu_popup_set_url(bw, a_History_get_url(NAV_TOP(bw))); +// a_Menu_popup_set_url(bw, a_History_get_url(NAV_TOP_UIDX(bw))); // gtk_menu_popup(GTK_MENU(bw->menu_popup.over_page), NULL, NULL, // NULL, NULL, event->button, event->time); // return TRUE; diff --git a/src/uicmd.cc b/src/uicmd.cc index 8b5157f1..30ae1f28 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -482,7 +482,7 @@ void a_UIcmd_bugmeter_popup(void *vbw) { BrowserWindow *bw = (BrowserWindow*)vbw; - a_Menu_bugmeter_popup(bw, a_History_get_url(NAV_TOP(bw))); + a_Menu_bugmeter_popup(bw, a_History_get_url(NAV_TOP_UIDX(bw))); } /* @@ -503,7 +503,7 @@ int *a_UIcmd_get_history(BrowserWindow *bw, int direction) // Fill the list i = a_Nav_stack_ptr(bw) + direction; for (j = 0 ; i >= 0 && i < a_Nav_stack_size(bw); i+=direction, j += 1) { - hlist[j] = NAV_IDX(bw,i); + hlist[j] = NAV_UIDX(bw,i); } hlist[j] = -1; @@ -546,6 +546,30 @@ void a_UIcmd_get_scroll_xy(BrowserWindow *bw, int *x, int *y) } /* + * Set the scroll position ({x, y} offset pair) + */ +void a_UIcmd_set_scroll_xy(BrowserWindow *bw, int x, int y) +{ + Layout *layout = (Layout*)bw->render_layout; + + if (layout) { + layout->scrollTo(HPOS_LEFT, VPOS_TOP, x, y, 0, 0); + } +} + +/* + * Set the scroll position by fragment (from URL) + */ +void a_UIcmd_set_scroll_by_fragment(BrowserWindow *bw, const char *f) +{ + Layout *layout = (Layout*)bw->render_layout; + + if (layout && f) { + layout->setAnchor(f); + } +} + +/* * Get location's text */ char *a_UIcmd_get_location_text(BrowserWindow *bw) diff --git a/src/uicmd.hh b/src/uicmd.hh index 125e87a3..01e9e819 100644 --- a/src/uicmd.hh +++ b/src/uicmd.hh @@ -45,6 +45,8 @@ void a_UIcmd_set_save_dir(const char *dir); void a_UIcmd_get_wh(BrowserWindow *bw, int *w, int *h); void a_UIcmd_get_scroll_xy(BrowserWindow *bw, int *x, int *y); +void a_UIcmd_set_scroll_xy(BrowserWindow *bw, int x, int y); +void a_UIcmd_set_scroll_by_fragment(BrowserWindow *bw, const char *f); char *a_UIcmd_get_location_text(BrowserWindow *bw); void a_UIcmd_set_location_text(void *vbw, const char *text); void a_UIcmd_set_page_prog(BrowserWindow *bw, size_t nbytes, int cmd); @@ -93,18 +93,6 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web, /* This method frees the old dw if any */ layout->setWidget(dw); - /* Scroll to were we were in this page */ - layout->scrollTo(HPOS_LEFT, VPOS_TOP, - URL_POSX(Web->url), URL_POSY(Web->url), 0, 0); - /* If we're at the origin and there's a fragment, go there instead */ - if (URL_POSX(Web->url) == 0 && URL_POSY(Web->url) == 0) { - char *f = a_Url_decode_hex_str(URL_FRAGMENT_(Web->url)); - if (f) { - layout->setAnchor(f); - dFree(f); - } - } - /* Clear the title bar for pages without a <TITLE> tag */ a_UIcmd_set_page_title(Web->bw, ""); a_UIcmd_set_location_text(Web->bw, URL_STR(Web->url)); |