summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrewski207 <drewski207@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-25 11:02:08 +0000
committerdrewski207 <drewski207@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-25 11:02:08 +0000
commitfca7347de9404de1f2940d58dae9bdda6ed52caf (patch)
treef6840bcb588fad8f56f4ea42c5faadeac081be8f
parent7c58e9f2f93efb2afbd3855c3ce8cc8492006433 (diff)
downloadfpGUI-fca7347de9404de1f2940d58dae9bdda6ed52caf.tar.xz
* fixed timers if the next timer should execute now
-rw-r--r--src/corelib/fpgfx.pas16
-rw-r--r--src/corelib/x11/gfx_x11.pas2
2 files changed, 13 insertions, 5 deletions
diff --git a/src/corelib/fpgfx.pas b/src/corelib/fpgfx.pas
index b94f45c1..e38c8700 100644
--- a/src/corelib/fpgfx.pas
+++ b/src/corelib/fpgfx.pas
@@ -314,19 +314,27 @@ var
n: integer;
t: TfpgTimer;
dt: TDateTime;
+ tb: Boolean;
begin
+ // returns -1 if no timers are pending
dt := ctime + amaxtime * ONE_MILISEC;
+ tb := False;
for n := 1 to fpgTimers.Count do
begin
t := TfpgTimer(fpgTimers[n - 1]);
- if t.Enabled and (t.NextAlarm < dt) then
+ if t.Enabled and (t.NextAlarm < dt) then begin
dt := t.NextAlarm;
+ tb := True;
+ end;
end;
- Result := trunc(0.5 + (dt - ctime) / ONE_MILISEC);
- if Result < 0 then
- Result := 0;
+ if tb then begin
+ Result := trunc(0.5 + (dt - ctime) / ONE_MILISEC);
+ if Result < 0 then
+ Result := 0;
+ end
+ else Result := -1;
end;
procedure TfpgTimer.SetEnabled(const AValue: boolean);
diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas
index a010c298..1935ff57 100644
--- a/src/corelib/x11/gfx_x11.pas
+++ b/src/corelib/x11/gfx_x11.pas
@@ -619,7 +619,7 @@ begin
xfd := XConnectionNumber(display);
repeat
- if (atimeoutms > 0) and (XPending(display) <= 0) then
+ if (atimeoutms >= 0) and (XPending(display) <= 0) then
begin
// waiting some event for the given timeout