Don't fire a pending idle action whose timeout was set to 0
The timers' intervals are bound to the configured delays, so setting the lock or screensaver to 0 while the screensaver is up turns a pending timer's interval to 0 and it fires at once. Check the action is still enabled when its timer fires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
14921a956e
commit
377b15be4b
2 files changed
+10
-2
No files matched your search
@@ -267,14 +267,14 @@ Item {
|
||||
id: screensaverTimer
|
||||
interval: root.screensaverDelaySeconds * 1000
|
||||
repeat: false
|
||||
onTriggered: root.launchScreensaver()
|
||||
onTriggered: if (root.screensaverEnabled) root.launchScreensaver()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: lockTimer
|
||||
interval: root.lockDelaySeconds * 1000
|
||||
repeat: false
|
||||
onTriggered: if (root.idleEnabled && root.idledThisCycle) root.lockSystem("lock-timeout")
|
||||
onTriggered: if (root.idleEnabled && root.idledThisCycle && root.lockEnabled) root.lockSystem("lock-timeout")
|
||||
}
|
||||
|
||||
Timer {
|
||||
|
||||
@@ -33,6 +33,14 @@ assert(
|
||||
/if \(root\.lockEnabled\) \{\s*\n\s*if \(root\.lockDelaySeconds === 0\) lockSystem/.test(serviceSource),
|
||||
'idle does not lock immediately when lock timeout is disabled'
|
||||
)
|
||||
assert(
|
||||
/id: screensaverTimer[\s\S]*?onTriggered: if \(root\.screensaverEnabled\) root\.launchScreensaver\(\)/.test(serviceSource),
|
||||
'idle does not launch a pending screensaver once its timeout is set to 0'
|
||||
)
|
||||
assert(
|
||||
/id: lockTimer[\s\S]*?onTriggered: if \([^)]*root\.lockEnabled\) root\.lockSystem\("lock-timeout"\)/.test(serviceSource),
|
||||
'idle does not fire a pending lock once its timeout is set to 0'
|
||||
)
|
||||
|
||||
assertDeepEqual(idle.eventParts({ data: 'a,b,c' }, 2), ['a', 'b', 'c'], 'idle parses raw event data')
|
||||
assertDeepEqual(
|
||||
|
||||
Reference in new issue
Block a user