Refactoring gui interface

Vincent Sanders vince at netsurf-browser.org
Mon Feb 3 00:14:26 GMT 2014


I have recently put a lot of effort into refactoring the interface
between the core and the front ends (gui)

This is the first step along the road to making the core of netsurf a
library that the front end toolkits can use as a widget.

All this is in an effort to make the required implementation for a
front end toolkit much more obvious and to remove many years of
accumulated cruft in the interfaces. It will also mean that in future
adding or altering an interface will mean modifying every front end
will be done in an obvious place.

When the core requires operations to be performed by the frontend they
are almost all now performed through a single table interface. This
table is passed to the netsurf_init() call every frontend makes.

The table comprises of a set of structures containing function
pointers. The change has absolutely no performance implications, the
same number of function calls are made and the same parameters are
passed as before.

Going forward some of these interfaces may be improved especially in
the area of error reporting (many of the operations currently have no
way of indicating an error)

I would like to ask all front end maintainers to consider their use of
the desktop/gui.h header. Previously it caused a great number of
additional headers, both system and local, to be included. 

The header now has the absolute minimum number of inclusions to ensure
the types for the tables are available and nothing more. 

I have cleaned up a great number of incorrect includes but I would
like to reduce this headers usage to the absolute minimum to make
ongoing cleanups have fewer unexpected side effects.

It should *only* be used by front ends when using the gui tables,
probably only from the modules actually implementing them. Currently
there are a number of frontend headers which it appears include
desktop/gui.h unnecessarily, these are:

windows/download.h
windows/gui.h
windows/plot.h
amiga/gui.h
riscos/save.h
beos/scaffolding.h
beos/window.h

If maintainers could remove any unnecessary includes from these headers
(and indeed anywhere else) it would be very helpful. The documentation
[1] on desktop/gui.h makes the current situation pretty clear.

There are now only a handful of remaining operations not in the gui
table. The known ones are:

die()
warn_user()

Though there appears to be font render operations in an alternate
interface which may warrant being merged. 

If anyone spots any more can they let me know


[1] http://ci.netsurf-browser.org/jenkins/job/docs-netsurf/doxygen/desktop_2gui_8h.html

-- 
Regards Vincent
http://www.kyllikki.org/



More information about the netsurf-dev mailing list