[Lazarus] Message Loop paused when no interaction with mouse?
Bernd
prof7bit at googlemail.com
Wed Apr 20 19:52:00 CEST 2011
2011/4/20 Henry Vermaak <henry.vermaak at gmail.com>:
> The patch doesn't touch synchronize. It worked o.k. for me before the
> patch. Maybe it's an fpc issue? I use 2.5.1 (about a month old).
I've done some more testing now.
Maybe its my old GTK2 version, I still have Ubuntu Hardy on my laptop
and the GTK2 that came with it (don't know which version exactly, I
never ever did anything with GTK directly, only through wrappers like
wx, etc., so I don't know much about GTK).
I have tried QueueAsyncCall and Synchronize() both don't work here.
PostMessage() works.
PostMessage() is the only one that I have found working without any
problems, it has only one little drawback: when I move the mouse over
the form it pauses the receiving of messages for about half a second
and then continues.
This might be unrelated but at one point while single-stepping through
it I have seen a strange loop in gtk2widgetset.inc
TGtk2WidgetSet.AppProcessMessages;
where it says:
// let gtk handle up to 100 messages and call our callbacks
i:=100;
while g_main_context_pending(g_main_context_default) and (i>0) do
begin
g_main_context_iteration(g_main_context_default, False);
dec(i);
end;
and then looped 100 times (not up to 100). This might not be related
to the half a second delay but it immediately came to my mind when I
noticed the behavior.
Btw: while looking at this code: What is this ifdef
USE_GTK_MAIN_OLD_ITERATION which caught my eye, might this be relevant
to my problem? Or should I not waste any time with this?
SendMessage()
I was hoping that SendMessage() would be the synchronized counterpart
to PostMessage() as I can vaguely remember from my old windows days
but it does not seem to be that way in LCL. It behaves like
PostMessage() and immediately returns with the only exception that
there is again the GUI waking problem, it won't wake up my GUI here
without manually interacting wit the mouse.
Conclusion: I will use PostMessge() for now for the purpose of waking
up the GUI, for my momentary needs this seems sufficient.
Bernd
More information about the Lazarus
mailing list