More work on tentacles.

This commit is contained in:
Storm Dragon committed 2026-11-03 23:48:31 -05:00
1 parent 573d15d7b4
commit 4cf3335017
29 files changed
+1194 -66

No files matched your search

+11
View File
@@ -22,6 +22,7 @@ import (
"sync/atomic"
"git.stormux.org/storm/cthulhu/internal/input"
"git.stormux.org/storm/cthulhu/internal/tentacle"
)
type commandGrabController interface {
@@ -30,6 +31,7 @@ type commandGrabController interface {
type focusGate struct {
tentacleOutput *tentacleOutput
remotePolicy *tentacle.RemotePolicy
ocr *ocrSession
mutex sync.Mutex
@@ -64,12 +66,21 @@ func (gate *focusGate) SetSuspended(suspended bool) bool {
return false
}
gate.retireTentacleOutput()
gate.sync_remote_policy()
if gate.commands != nil {
gate.commands.SetCommandGrabs(!suspended && !gate.secure.Load())
}
return true
}
// Called during startup or with gate.mutex held. Cancellation never calls back
// into the gate or runtime locks. Lock/unlock and handoff cannot restore consent.
func (gate *focusGate) sync_remote_policy() {
if gate.remotePolicy != nil {
gate.remotePolicy.SetAvailable(!gate.secure.Load() && !gate.suspended.Load())
}
}
func (gate *focusGate) InternalUIActive() bool {
return gate != nil && gate.internalUI != nil && gate.internalUI.InternalUIActive()
}