[linux-audio-dev] [ot] How do GUI-libs notify the program of changes?

James Courtier-Dutton James at superbug.co.uk
Mon Apr 10 20:49:50 UTC 2006


Julien Claassen wrote:
> Hi all!
>   I know it's completely OT, but I think there maybe people here, who could
> help me.
>   Problem is: I'm still on my libcui (character user interface) project and I
> wonder:
>   I push a button, slide a slider... How does the UI notify the program of
> this change? How do Engine and UI communicate?
>   Please anyone: HELP ME!
>   Kindest regards
>        Julien
> 

Most GUIs are "Event" driven by means of message passing.
The GUI would just listen to the messages from the "Engine" and send 
messages to the engine.
The listening thread would register it's interest in a particular 
message queue. This is done by the listening thread informing the 
"Engine" of it's callback function via a function pointer.
The "Engine" would simply build up a linked list of all the listeners 
for a particular queue, and then call each callback function for each 
and every message it received.
So, if the user "push a button", that causes a message to be added to 
the message queue. The "Engine" would then call all the callback 
functions saying "push a button", so all the listeners now know that a 
button was pressed.

James



More information about the Linux-audio-dev mailing list