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

From: James Courtier-Dutton <James@email-addr-hidden>
Date: Mon Apr 10 2006 - 23:49:50 EEST

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
Received on Tue Apr 11 04:15:06 2006

This archive was generated by hypermail 2.1.8 : Tue Apr 11 2006 - 04:15:06 EEST