JSI_GUIMouse:
rP666 introduced the GUI <-> JS Interface.
rP8657 removed the only use of JSI_GUIMouse, and because nowadays SDL events are converted to JS and since it doesn't really make sense to create a Mouse object in JS and send it to C++, the class should
be considered obsolete and removed.
JSI_IGUIObject::construct rP666 also introduced the constructor of JSI_IGUIObjects. But that constructor is (at least nowadays) only called form JS and adding new GUI objects from JS is something we
don't have a use case for yet, it would likely add to messy code. It is good to have every JS object defined in XML prior before they are accessed, leaving the new reader with a clear summary of which
objects exist before they start to dig into the code. If we ever run into a use case where we want to add a GUIObject by JS, there will have to be much more code, updating the GUI page with the new
object and such. Conclusively this constructor is unused and merely confusing the reader by pretending to be relevant.
Notice that JSI_GUISize and JSI_GUIColor actually are created from JS and passed to JS, so it makes sense to have these JSClasses.
Cleanup:
- The headers are rectified a bit.
- The JS functions receive the JSPROP_ENUMERATE, JSPROP_READONLY, JSPROP_PERMANENT flags, so that JS can't mess with them.
- { 0 } -> JS_PS_END
- Rename init to RegisterScriptClass for more transparency and consistency in
ScriptFunctions.cpp
JS_THIS_OBJECT: This macro was removed from Firefox 61, so it is likely to also be removed in SM then. The replacement looks cleaner anyhow. https://bugzilla.mozilla.org/show_bug.cgi?id=1255800
Renames that will not be done in this patch:
- g_GUI should be g_GUIManager whereas CGUI should be CGUIPage
- JSInterface_IGUIObject ought to be JSInterface_GUIObject for consistency with the other JSInterface_GUIfoo.
- JSInterface_GUITypes.cpp should be split into JSInterface_GUISize.cpp and JSInterface_GUIColor.cpp, so it is easier to add new types and one doesn't have to read all types to understand one
file, but only one type.