mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 12:36:51 +03:00
Add functions for checking if back/forward/stop/reload actions are currently available for a given browser window.
svn path=/trunk/netsurf/; revision=6827
This commit is contained in:
parent
972cd147aa
commit
0a7e10819b
@ -270,7 +270,7 @@ void browser_window_go_unverifiable(struct browser_window *bw,
|
|||||||
*
|
*
|
||||||
* If post_urlenc and post_multipart are 0 the url is fetched using GET.
|
* If post_urlenc and post_multipart are 0 the url is fetched using GET.
|
||||||
*
|
*
|
||||||
* The page is not added to the window history if add_to_history is false.
|
* The page is not added to the window history if add_to_history is false.
|
||||||
* This should be used when returning to a page in the window history.
|
* This should be used when returning to a page in the window history.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -697,7 +697,7 @@ void browser_window_refresh(void *p)
|
|||||||
add_to_history = false;
|
add_to_history = false;
|
||||||
|
|
||||||
/* Treat an (almost) immediate refresh in a top-level browser window as
|
/* Treat an (almost) immediate refresh in a top-level browser window as
|
||||||
* if it were an HTTP redirect, and thus make the resulting fetch
|
* if it were an HTTP redirect, and thus make the resulting fetch
|
||||||
* verifiable.
|
* verifiable.
|
||||||
*
|
*
|
||||||
* See fetchcache.c for why redirected fetches should be verifiable at
|
* See fetchcache.c for why redirected fetches should be verifiable at
|
||||||
@ -794,10 +794,10 @@ void browser_window_update(struct browser_window *bw)
|
|||||||
|
|
||||||
if (!history_get_current_scroll(bw->history, &sx, &sy))
|
if (!history_get_current_scroll(bw->history, &sx, &sy))
|
||||||
sx = -1;
|
sx = -1;
|
||||||
|
|
||||||
/* if the page was scrolled before return to that position */
|
/* if the page was scrolled before return to that position */
|
||||||
if (sx != -1) {
|
if (sx != -1) {
|
||||||
gui_window_set_scroll(bw->window, sx, sy);
|
gui_window_set_scroll(bw->window, sx, sy);
|
||||||
/* if frag_id exists, then try to scroll to it */
|
/* if frag_id exists, then try to scroll to it */
|
||||||
} else if (bw->frag_id && bw->current_content->type == CONTENT_HTML) {
|
} else if (bw->frag_id && bw->current_content->type == CONTENT_HTML) {
|
||||||
if ((pos = box_find_by_id(bw->current_content->data.html.layout, bw->frag_id)) != 0) {
|
if ((pos = box_find_by_id(bw->current_content->data.html.layout, bw->frag_id)) != 0) {
|
||||||
@ -805,7 +805,7 @@ void browser_window_update(struct browser_window *bw)
|
|||||||
gui_window_set_scroll(bw->window, x, y);
|
gui_window_set_scroll(bw->window, x, y);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
gui_window_set_scroll(bw->window, 0, 0);
|
gui_window_set_scroll(bw->window, 0, 0);
|
||||||
|
|
||||||
gui_window_redraw_window(bw->window);
|
gui_window_redraw_window(bw->window);
|
||||||
}
|
}
|
||||||
@ -2798,3 +2798,57 @@ void browser_window_page_drag_start(struct browser_window *bw, int x, int y)
|
|||||||
|
|
||||||
gui_window_scroll_start(bw->window);
|
gui_window_scroll_start(bw->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check availability of Back action for a given browser window
|
||||||
|
*
|
||||||
|
* \param bw browser window
|
||||||
|
* \return true if Back action is available
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool browser_window_back_available(struct browser_window *bw)
|
||||||
|
{
|
||||||
|
return (bw && bw->history && history_back_available(bw->history));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check availability of Forward action for a given browser window
|
||||||
|
*
|
||||||
|
* \param bw browser window
|
||||||
|
* \return true if Forward action is available
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool browser_window_forward_available(struct browser_window *bw)
|
||||||
|
{
|
||||||
|
return (bw && bw->history && history_forward_available(bw->history));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check availability of Reload action for a given browser window
|
||||||
|
*
|
||||||
|
* \param bw browser window
|
||||||
|
* \return true if Reload action is available
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool browser_window_reload_available(struct browser_window *bw)
|
||||||
|
{
|
||||||
|
return (bw && bw->current_content && !bw->loading_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check availability of Stop action for a given browser window
|
||||||
|
*
|
||||||
|
* \param bw browser window
|
||||||
|
* \return true if Stop action is available
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool browser_window_stop_available(struct browser_window *bw)
|
||||||
|
{
|
||||||
|
return (bw && (bw->loading_content ||
|
||||||
|
(bw->current_content &&
|
||||||
|
(bw->current_content->status != CONTENT_STATUS_DONE))));
|
||||||
|
}
|
||||||
|
@ -250,6 +250,11 @@ void browser_form_submit(struct browser_window *bw, struct browser_window *targe
|
|||||||
void browser_window_redraw_rect(struct browser_window *bw, int x, int y,
|
void browser_window_redraw_rect(struct browser_window *bw, int x, int y,
|
||||||
int width, int height);
|
int width, int height);
|
||||||
|
|
||||||
|
bool browser_window_back_available(struct browser_window *bw);
|
||||||
|
bool browser_window_forward_available(struct browser_window *bw);
|
||||||
|
bool browser_window_reload_available(struct browser_window *bw);
|
||||||
|
bool browser_window_stop_available(struct browser_window *bw);
|
||||||
|
|
||||||
/* In platform specific hotlist.c. */
|
/* In platform specific hotlist.c. */
|
||||||
void hotlist_visited(struct content *content);
|
void hotlist_visited(struct content *content);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user