From 297a53ac4981796eecb626a68c56e6db93cfb16a Mon Sep 17 00:00:00 2001 From: "Rich O." Date: Tue, 3 Nov 2026 08:46:53 -0500 Subject: [PATCH] palm-client: exiting keeps a pending background-check alarm (the time Preferences showed) --- palm-client/src/bgcheck.c | 10 ++++++++++ palm-client/src/bgcheck.h | 4 +++- palm-client/src/main.c | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/palm-client/src/bgcheck.c b/palm-client/src/bgcheck.c index cfd7f39..5dc8ed2 100644 --- a/palm-client/src/bgcheck.c +++ b/palm-client/src/bgcheck.c @@ -94,6 +94,16 @@ void BgSchedule(void) SetAlarm(minutes ? TimGetSeconds() + (UInt32)minutes * 60 : 0); } +void BgScheduleIfIdle(void) +{ + UInt16 card; + LocalID id; + UInt32 ref; + + if (!FindSelf(&card, &id) || AlmGetAlarm(card, id, &ref) <= TimGetSeconds()) + BgSchedule(); +} + void BgAlarmTriggered(SysAlarmTriggeredParamType *p) { UInt16 card, curCard; diff --git a/palm-client/src/bgcheck.h b/palm-client/src/bgcheck.h index 5629ccf..9ab8ff6 100644 --- a/palm-client/src/bgcheck.h +++ b/palm-client/src/bgcheck.h @@ -8,7 +8,7 @@ * for display, and BgDisplayAlarm shows an alert with an Open button. * * While the app is open it checks for itself: the alarm keeps coming and is - * skipped, and exiting sets it N minutes on. + * skipped. */ #ifndef VM_BGCHECK_H #define VM_BGCHECK_H @@ -24,6 +24,8 @@ void BgSetInterval(UInt16 minutes); /* Sets the next alarm from the interval (clears it when off). */ void BgSchedule(void); +/* BgSchedule unless an alarm is already pending (at exit: keeps the time Preferences showed). */ +void BgScheduleIfIdle(void); /* Launch codes; no globals needed. */ void BgAlarmTriggered(SysAlarmTriggeredParamType *p); diff --git a/palm-client/src/main.c b/palm-client/src/main.c index 6c83119..6b53622 100644 --- a/palm-client/src/main.c +++ b/palm-client/src/main.c @@ -206,7 +206,7 @@ UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) ChannelsClose(); MessagesClose(); UiFontRelease(); - BgSchedule(); + BgScheduleIfIdle(); } return errNone; }