This page documents the
functions that need to be implemented by each platform's front end.
Note: in progress and incomplete

The prototypes for these functions are usually in gui/gui.h. The implementations live in the platform code, for example gui_init() is implemented in each of amiga/gui.c, beos/beos_gui.cpp, framebuffer/gui.c, gtk/gtk_gui.c, riscos/gui.c, and windows/gui.c. Of course only one of those implementations is ever compiled into a binary of NetSurf.

Initialization and clean-up

int main(int argc, char** argv)

This is the standard C entry point. It should do any critical very-early initialization is required, and finish with

return netsurf_main(argc, argv);

The prototype may differ on some platforms.

void gui_init(int argc, char** argv)

General initialization of platform stuff. Prepare the gui for use, but don't yet open any windows.

It should call:

  • hubbub_initialise(), with the platform-specific path to the Aliases file
  • options_read(), if saving and loading options is supported
  • messages_load(), with the platform-specific path to the Messages file
  • save_complete_init(), if save complete is used
  • urldb_load() and urldb_load_cookies()

Should set default_stylesheet_url, quirks_stylesheet_url, and adblock_stylesheet_url.

(Called by netsurf_init() in desktop/netsurf.c.)

void gui_init2(int argc, char** argv)

Last-step of initialization. Can open window(s) by calling browser_window_create() (e.g. depending on argv).

(Called by netsurf_init() in desktop/netsurf.c.)

void gui_quit(void)

Prepare for exit by doing whatever is needed by the platform.

It should call:

  • urldb_save_cookies() and urldb_save()
  • hubbub_finalise()

(Called by netsurf_exit() in desktop/netsurf.c.)


void gui_multitask(void)

NetSurf's core will occasionally call this during long-running operations. It should yield briefly to the OS if applicable, and handle urgent gui events to keep NetSurf responsive. Then it should return quickly.

It must not call any function in the core or non-platform code.