int error = AdapterMainLoop(lua_State *L, int (*f)(APTR data), APTR data, ULONG flags, struct hwTagList *tags);
HWEXT_DISPLAYADAPTER_MAINLOOPextension bit has been set. See Extension plugins for details. In that case, it must start the display adapter's main loop and after that run the function that is passed in the second parameter forwarding the third parameter
Normally, Hollywood doesn't explicitly ask display adapters to start their main
loop since not all toolkits are main loop-based. Instead, by default, Hollywood repeatedly asks
display adapters to wait for events by calling the WaitEvents()
function and to handle events by calling the HandleEvents()
function. Some toolkits, however, don't fit into this model very well because their
API expects you to call a function which runs the main loop which in turn does all
the event waiting and handling. If the toolkit your display adapter uses employs
such a design, you can set the
HWEXT_DISPLAYADAPTER_MAINLOOP extension bit to
make Hollywood ask your plugin to start its main loop and call the function which
hands back control to Hollywood after the main loop has been started.
Note that even if
HWEXT_DISPLAYADAPTER_MAINLOOP has been set, Hollywood will still
call your display adapter's WaitEvents() and HandleEvents()
functions but you don't have to do anything in WaitEvents() then.
It can just be an empty function. However, in HandleEvents()
you still have to call into the master server and run timer callbacks. See HandleEvents for details.
Since this function starts the main loop of your display adapter, it is not expected to return until Hollywood should shut down, i.e. until the user has closed all displays managed by your display adapter.