[Customdrawn] Replace some widgets
Michael Schnell
mschnell at lumino.de
Thu Apr 5 15:10:46 CEST 2012
On 04/05/2012 02:28 PM, Giuliano Colla wrote:
> Momentarily I've simply taken advantage of X11 message queue, but I'm
> also considering other possibilities,
After many discussions during some years, I have been convinced, that
for performance issues, an event queue provided by the backend API
should be used whenever possible.
For a "Windows" backend, this is strictly always, because you can always
send "Messages" to the mainthread that get queued together with the GUI
and the Timer events generated by the API itself. Of course waiting on
an event is done in the GUI API.
For GTK and similar backends, I understand that you can't feed events
to the queue provided by the API, and that is why you need to implement
a queue in user code and in the main loop you need to somehow mix the
events that are fetched from both queue. Waiting might get complicated,
as if you do waiting just in the GUI API, you don't wake up for events
that are not generated by the GUI API itself, but are scheduled via your
own queue (this problem has only quite recently be solved <on my
request> for GTK2).
For a "native" backend done in Pascal code, you of course need to
provide an event queue for all events (generated by Timers, Threads and
possibly incoming messages from the remote GUI). Of course waiting and
waking up needs to be done using directly the means of the underlying
OS'es API.
> It would be preferable to have an event queue common for all backends,
> and therefore this implies taking into account many factors.
It might be worth testing whether it is preferable to pass all events
through this queue or to use the GUI API's queue in parallel for events
generated by the GUI itself. I suppose a non-trivial problem is the
waiting and waking up whenever the queue (any of the queues) gets from
empty to not empty. If all events are passed through the queue
implemented in Pascal, waiting should be done by means of an OS Library
(in Linux pthreads_mutex_...() calls is the obvious choice)
> However, it that's what you need, I think you'll get it. Sooner or
> later :-)
>
Yep !
Thanks a lot for listening !
-Michael
More information about the Customdrawn
mailing list