mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 17:19:23 +02:00
LCL-CustomDrawn-X11: Fixes timers with zero interval, adds support for Application.Idle calling and more checks for Terminated
git-svn-id: trunk@34356 -
This commit is contained in:
parent
ecf3f41b11
commit
383db45538
@ -432,9 +432,11 @@ begin
|
|||||||
lTimeoutInterval := GetSmallestTimerInterval();
|
lTimeoutInterval := GetSmallestTimerInterval();
|
||||||
// Limit the maximum interval, even if only to process Application.OnIdle or
|
// Limit the maximum interval, even if only to process Application.OnIdle or
|
||||||
// for general safety
|
// for general safety
|
||||||
if (lTimeoutInterval <= 0) or (lTimeoutInterval >= 1000) then lTimeoutInterval := 1000;
|
if (lTimeoutInterval < 0) or (lTimeoutInterval >= 1000) then lTimeoutInterval := 1000;
|
||||||
|
// To avoid consuming too much CPU, if the interval is zero, act as if it was 1
|
||||||
|
if lTimeoutInterval = 0 then lTimeoutInterval := 1;
|
||||||
|
|
||||||
while True do
|
while not Application.Terminated do
|
||||||
begin
|
begin
|
||||||
xconnnum := XConnectionNumber(FDisplay);
|
xconnnum := XConnectionNumber(FDisplay);
|
||||||
XFlush(FDisplay);
|
XFlush(FDisplay);
|
||||||
@ -470,7 +472,12 @@ begin
|
|||||||
if selectresult <> 0 then // We got a X event or the timeout happened
|
if selectresult <> 0 then // We got a X event or the timeout happened
|
||||||
Exit
|
Exit
|
||||||
else
|
else
|
||||||
Continue; // nothing further to do here!
|
begin
|
||||||
|
// Process standard application Idle
|
||||||
|
if not Application.Terminated then Application.Idle(False);
|
||||||
|
|
||||||
|
Continue; // Go back and keep waiting for a message
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
Loading…
Reference in New Issue
Block a user