summaryrefslogtreecommitdiff
path: root/documentation/front_end_functions.mdwn
blob: 4e056f4930fdfff18c85765ce73d5f57e1072bbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
[[!meta title="Documentation/Front end functions"]]
[[!meta author="James Bursa"]]
[[!meta date="2011-11-26T22:20:01Z"]]


[[!toc]] 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.)

Multitasking
------------

### 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.

[[!inline raw=yes pages="Documentation"]]