Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
bw.c File Reference

Data structures for each browser window. More...

#include "bw.h"
#include "msg.h"
#include "list.h"
#include "capi.h"
#include "uicmd.hh"
Include dependency graph for bw.c:

Go to the source code of this file.

Functions

void a_Bw_init (void)
 Initialize global data.
 
BrowserWindowa_Bw_new (void)
 Create a new browser window and return it.
 
void a_Bw_free (BrowserWindow *bw)
 Free resources associated to a bw.
 
void a_Bw_add_client (BrowserWindow *bw, int Key, int Root)
 Add a reference to a cache-client.
 
int a_Bw_remove_client (BrowserWindow *bw, int ClientKey)
 Remove the cache-client from the bw's list (client can be a image or a html page) Return: 0 if found, 1 otherwise.
 
void a_Bw_close_client (BrowserWindow *bw, int ClientKey)
 Close a cache-client upon successful retrieval.
 
void a_Bw_stop_clients (BrowserWindow *bw, int flags)
 Stop the active clients of this bw's top page.
 
void a_Bw_add_url (BrowserWindow *bw, const DilloUrl *Url)
 Add an URL to the browser window's list.
 
void a_Bw_add_doc (BrowserWindow *bw, void *vdoc)
 Add a document to the browser window's list.
 
void * a_Bw_get_current_doc (BrowserWindow *bw)
 Get current document.
 
void * a_Bw_get_url_doc (BrowserWindow *bw, const DilloUrl *url)
 Get document by URL.
 
void a_Bw_remove_doc (BrowserWindow *bw, void *vdoc)
 Remove a document from the bw's list.
 
void a_Bw_cleanup (BrowserWindow *bw)
 Empty RootClients, ImageClients and PageUrls lists and reset progress bar data.
 
int a_Bw_num (void)
 
BrowserWindowa_Bw_get (int i)
 Return a bw by index.
 
void a_Bw_expect (BrowserWindow *bw, const DilloUrl *url)
 
void a_Bw_cancel_expect (BrowserWindow *bw)
 
bool_t a_Bw_expecting (BrowserWindow *bw)
 
const DilloUrla_Bw_expected_url (BrowserWindow *bw)
 

Variables

static BrowserWindow ** bws
 
static int num_bws
 
static int num_bws_max
 

Detailed Description

Data structures for each browser window.

Definition in file bw.c.

Function Documentation

◆ a_Bw_add_client()

void a_Bw_add_client ( BrowserWindow bw,
int  Key,
int  Root 
)

Add a reference to a cache-client.

It is kept int this bw's list. This helps us keep track of which are active in the window so that it's possible to abort/stop them. (Root: Flag, whether a Root URL or not)

TODO: Make NumImages count different images.

Definition at line 128 of file bw.c.

References a_UIcmd_set_buttons_sens(), a_UIcmd_set_img_prog(), dList_append(), dList_length(), dReturn_if_fail, BrowserWindow::ImageClients, INT2VOIDP, BrowserWindow::NumImages, BrowserWindow::NumImagesGot, and BrowserWindow::RootClients.

Referenced by a_Html_load_stylesheet(), StyleEngine::apply(), Html_load_image(), and Nav_open_url().

◆ a_Bw_add_doc()

void a_Bw_add_doc ( BrowserWindow bw,
void *  vdoc 
)

Add a document to the browser window's list.

Definition at line 221 of file bw.c.

References dList_append(), BrowserWindow::Docs, and dReturn_if_fail.

Referenced by DilloHtml::DilloHtml().

◆ a_Bw_add_url()

void a_Bw_add_url ( BrowserWindow bw,
const DilloUrl Url 
)

Add an URL to the browser window's list.

This helps us keep track of page-requested URLs so that it's possible to stop, abort and reload them.

Definition at line 209 of file bw.c.

References a_Url_cmp(), a_Url_dup(), dList_append(), dList_find_custom(), dReturn_if_fail, and BrowserWindow::PageUrls.

Referenced by a_Html_load_stylesheet(), StyleEngine::apply(), Html_load_image(), and Nav_open_url().

◆ a_Bw_cancel_expect()

void a_Bw_cancel_expect ( BrowserWindow bw)

Definition at line 328 of file bw.c.

References a_Url_free(), and BrowserWindow::nav_expect_url.

Referenced by a_Nav_cancel_expect().

◆ a_Bw_cleanup()

void a_Bw_cleanup ( BrowserWindow bw)

Empty RootClients, ImageClients and PageUrls lists and reset progress bar data.

Definition at line 277 of file bw.c.

References a_Url_free(), dList_nth_data(), dList_remove_fast(), BrowserWindow::ImageClients, BrowserWindow::NumImages, BrowserWindow::NumImagesGot, BrowserWindow::NumPendingStyleSheets, BrowserWindow::PageUrls, and BrowserWindow::RootClients.

Referenced by Nav_open_url().

◆ a_Bw_close_client()

void a_Bw_close_client ( BrowserWindow bw,
int  ClientKey 
)

Close a cache-client upon successful retrieval.

Remove the cache-client from the bw list and update the meters. (client can be a image or a html page)

Definition at line 167 of file bw.c.

References a_Bw_remove_client(), a_UIcmd_set_buttons_sens(), a_UIcmd_set_img_prog(), dList_length(), BrowserWindow::NumImages, BrowserWindow::NumImagesGot, and BrowserWindow::RootClients.

Referenced by a_Dicache_callback(), a_Dicache_close(), Cache_null_client(), DilloHtml::finishParsing(), and Plain_callback().

◆ a_Bw_expect()

void a_Bw_expect ( BrowserWindow bw,
const DilloUrl url 
)

Definition at line 322 of file bw.c.

References a_Url_dup(), a_Url_free(), and BrowserWindow::nav_expect_url.

Referenced by a_Nav_push(), Nav_reload_callback(), and Nav_repush().

◆ a_Bw_expected_url()

const DilloUrl * a_Bw_expected_url ( BrowserWindow bw)

Definition at line 339 of file bw.c.

References BrowserWindow::nav_expect_url.

Referenced by a_Nav_cancel_expect_if_eq(), a_Nav_expect_done(), and a_Nav_push().

◆ a_Bw_expecting()

bool_t a_Bw_expecting ( BrowserWindow bw)

◆ a_Bw_free()

◆ a_Bw_get()

BrowserWindow * a_Bw_get ( int  i)

Return a bw by index.

Definition at line 313 of file bw.c.

References bws, and num_bws.

Referenced by a_UIcmd_close_all_bw(), and a_UIcmd_get_bw_by_widget().

◆ a_Bw_get_current_doc()

void * a_Bw_get_current_doc ( BrowserWindow bw)

Get current document.

Definition at line 231 of file bw.c.

References dList_length(), dList_nth_data(), BrowserWindow::Docs, and MSG.

Referenced by a_Bw_get_url_doc(), and Menu_imgload_toggle_cb().

◆ a_Bw_get_url_doc()

void * a_Bw_get_url_doc ( BrowserWindow bw,
const DilloUrl url 
)

Get document by URL.

This is currently used by popup menus that need to ensure that the page has not changed while the menu was popped up.

Definition at line 250 of file bw.c.

References a_Bw_get_current_doc(), a_Url_cmp(), dList_find_custom(), and BrowserWindow::PageUrls.

Referenced by Menu_form_hiddens_cb(), Menu_form_reset_cb(), Menu_form_submit_cb(), and Menu_load_images_cb().

◆ a_Bw_init()

void a_Bw_init ( void  )

Initialize global data.

Definition at line 36 of file bw.c.

References bws, num_bws, and num_bws_max.

Referenced by main().

◆ a_Bw_new()

◆ a_Bw_num()

int a_Bw_num ( void  )

Definition at line 305 of file bw.c.

References num_bws.

Referenced by a_UIcmd_close_all_bw(), and a_UIcmd_get_bw_by_widget().

◆ a_Bw_remove_client()

int a_Bw_remove_client ( BrowserWindow bw,
int  ClientKey 
)

Remove the cache-client from the bw's list (client can be a image or a html page) Return: 0 if found, 1 otherwise.

Definition at line 149 of file bw.c.

References dList_find(), dList_remove_fast(), BrowserWindow::ImageClients, INT2VOIDP, BrowserWindow::NumImagesGot, and BrowserWindow::RootClients.

Referenced by a_Bw_close_client(), a_Cache_process_dbuf(), and Cache_process_queue().

◆ a_Bw_remove_doc()

void a_Bw_remove_doc ( BrowserWindow bw,
void *  vdoc 
)

Remove a document from the bw's list.

Definition at line 263 of file bw.c.

References dList_find(), dList_remove_fast(), and BrowserWindow::Docs.

Referenced by DilloHtml::~DilloHtml().

◆ a_Bw_stop_clients()

void a_Bw_stop_clients ( BrowserWindow bw,
int  flags 
)

Stop the active clients of this bw's top page.

Note: rendering stops, but the cache continues to be fed.

Definition at line 182 of file bw.c.

References a_Capi_stop_client(), BW_Force, BW_Img, BW_Root, dList_nth_data(), dList_remove_fast(), BrowserWindow::ImageClients, BrowserWindow::RootClients, and VOIDP2INT.

Referenced by a_UIcmd_close_bw(), a_UIcmd_stop(), and Nav_open_url().

Variable Documentation

◆ bws

BrowserWindow** bws
static

Definition at line 29 of file bw.c.

Referenced by a_Bw_free(), a_Bw_get(), a_Bw_init(), and a_Bw_new().

◆ num_bws

int num_bws
static

Definition at line 30 of file bw.c.

Referenced by a_Bw_free(), a_Bw_get(), a_Bw_init(), a_Bw_new(), and a_Bw_num().

◆ num_bws_max

int num_bws_max
static

Definition at line 30 of file bw.c.

Referenced by a_Bw_init(), and a_Bw_new().