[GUI] The register/unregister callbacks issue
Peter Achten
peter88@cs.kun.nl
Wed, 19 Mar 2003 16:40:13 +0100
At 14:51 19-3-03 +0000, Alistair Reid wrote:
>Peter Achten <peter88@cs.kun.nl> writes:
>
> > In my opinion a programmer should not have to register/unregister
> > callbacks explicitly.
>
>I don't understand what you're proposing in its place.
>
>You say that on X you do need to [un]register callbacks and on Windows
>you use a filter function to determine whether or not to use the
>callback. Either way, it seems that there is some mechanism which
>lets the backend (windows, X, Motif, etc) know that you no longer need
>to receive events of that type so the API is going to have to provide
>appropriate functions. That is, there will be a way to register to
>receive those events and a way to stop receiving those events.
>Whether they register and unregister a callback or change a bitset
>defining which events to receive or do something else is largely
>irrelevant.
What I am saying is that a good GUI program already tells the user (and
therefore also the backend) what events it will respond to. It will
disable/enable menu(elements), it will disable/enable window(elements). As
a consequence the API has no need for an additional register/unregister
mechanism.
The filter function is a convenient and light-weight means of additionally
telling the backend what kind of events you're (not) interested in in case
of enabled gui elements (in particular mouse and keyboard events).
Regards,
Peter