[Lazarus] Message Loop paused when no interaction with mouse?
Bernd
prof7bit at googlemail.com
Wed Apr 20 12:55:18 CEST 2011
2011/4/20 Henry Vermaak <henry.vermaak at gmail.com>:
> See here for a related issue:
>
> http://bugs.freepascal.org/view.php?id=13120
>
> You'll have to wake up the main thread after the frame (which is what your
> timer is doing). For gtk you can use
> g_main_context_wakeup(g_main_context_default), for qt there is
> QEventLoop::wakeUp().
Thank you, this is what I have read a while ago but could not find
anymore due to the wrong serch terms.
But it does not seem to help :-(
This is how my thread looks like now:
procedure Execute;
begin
while ...
begin
...
...
if ...
begin
...
...
ppx := PInteger(Display.Picture.Bitmap.RawImage.Data);
for y:=0 to CAM_HEIGHT-1 do begin
for x:=0 to CAM_WIDTH-1 do begin
with CamImage[y,x] do begin
ppx^ := Red << 16 + Green << 8 + Blue;
ppx += 1;
end;
end;
end;
writeln('---------------- QueueAsyncCall()');
Application.QueueAsyncCall(@FrameComplete, 0);
g_main_context_wakeup(g_main_context_default);
end;
end;
end;
procedure TReceiver.FrameComplete(data: PtrInt);
begin
writeln('**************** in FrameComplete()');
Display.Picture.Bitmap.EndUpdate();
Display.Picture.Bitmap.BeginUpdate();
end;
it will happily print '---------------- QueueAsyncCall()' to the
console after every frame but nothing else and only if I move the
mouse I will get a whole bunch of meanwhile accumulatd
'**************** in FrameComplete()' interleaved with the subsequent
writeln from my TImage.OnPictureChanged() event handler all at once
until the queue is empty again.
Without mouse still no way to wake up the GUI.
Synchronize() instead of QueueAsyncCall() would halt my thread
completely because it would wait for the sleeping GUI and never return
until I move the mouse. nd also It is not clear to me how this could
ever work with synchronize() at ll since i would have to wake up the
GUI *after* the call but then my thread would be blocked already.
I think this is a serious problem. How is Synchonize() supposed to be
used at all? It seems it has no use at all with this bug at the
moment?
More information about the Lazarus
mailing list