Hi,
My understanding of how it works:
PlayOnLinux statements are Bash shell functions, and the ones that need to interact with the GUI part (take the ones from lib/setupwindow.lib for instance) contain a call to the ncs function, example:
POL_SimpleMessage ()
{
# Shows a text box
# Usage: POL_SetupWindow_textbox [message] [title] [default value]
# Result is sent in $APP_ANSWER variable
echo "$POL_COOKIE SimpleMessage $(POL_Untab "$1")" | ncs "$POL_HOST" "$POL_PORT"
}
which is defined near the top of this same file as
ncs()
{
# Silent netcat
ncns "$@" > /dev/null 2> /dev/null
}
ncns()
{
if [ "$POL_OS" = "Mac" -o "$(POL_Config_Read FORCE_LEGACY_NETCAT)" = "TRUE" ]; then
nc "$@"
else
nc -q -1 "$@" 2> /dev/null || nc "$@"
# Differents possibilities
fi
}
To keep it short, they have at their core a call to the nc command (aka netcat), to send some line of data over a TCP socket to a server in the GUI
To see this other side, we have to head to python/gui_server.py, at gui_server.initServer() for the creation of the server socket (and the creation of $POL_COOKIE value that will be used to authorize connections), gui_server.run() for the main loop, gui_server;handler()/gui_server.interact()/MainWindow.SetupWindowTimer_SendToGui() for delivery to MainWindow.SetupWindowTimer_action variable
Then MainWindow.SetupWindowAction(), periodically called by a timer, polls this variable and calls gui_server.readAction() when it contains something.
This is where the received command is finally parsed and dispatched to server objects as method calls.