[Lazarus] Message Loop paused when no interaction with mouse?

Michael Schnell mschnell at lumino.de
Wed Apr 20 16:22:31 CEST 2011


On 04/20/2011 03:51 PM, Bernd wrote:
>
> Are there any other ways under GTK2 (or xorg?) to send a message to a
> window that simulates user interaction?
Something is broken in the infra-structure of the Event queuing 
mechanism with GTK2 and this can hit in multiple issues. As long as 
TApplication.QueuAsyncCall() (that supposedly uses the basics of the 
mechanism) does not work reliably, you can't trust the event scheduling 
mechanism.

For your own Events you could uses the Windowish "PostMessage" interface 
to access a "procedure...Message()". Same seems to work with the current 
GTK2

Last time I checked, TApplication.QueuAsyncCall() did work with the (now 
unsupported) gtk ("1") Widgest Type.
> What exactly does the TTimer do when it fires its event? The TTimer
> seems to have the power to wake up the GUI, maybe I can do the same
> manually?
AFAIK the TTimer is just a GUI element direct provided by GTK itself, so 
the LCL does not need to actively stuff events in the queue and wake the 
GUI thread.

Stuffing events in the queue seems always to be workable but waking the 
GUI thread does not seem to work reliably with some Widget Types, so 
manually waking it by moving the mouse or something like this does make 
the GUI thread handle all scheduled events. My testing program shows 
that  a TTimer doing nothing indeed wakes the GUI thread and makes it 
handle the queued events. Also doing a "PostMessage" to an empty 
"procedure...Message;" seems wake the GUI  Thread and makes it handle 
the queued events.

-Michael




More information about the Lazarus mailing list