diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/fpgfx.pas | 16 | ||||
-rw-r--r-- | src/corelib/x11/gfx_x11.pas | 2 |
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 |