mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
gamma: dont transition before destroying controls
This commit is contained in:
@@ -607,37 +607,6 @@ func (m *Manager) transitionWorker() {
|
|||||||
|
|
||||||
if finalTarget == targetTemp {
|
if finalTarget == targetTemp {
|
||||||
log.Debugf("Transition complete: now at %dK", targetTemp)
|
log.Debugf("Transition complete: now at %dK", targetTemp)
|
||||||
|
|
||||||
m.configMutex.RLock()
|
|
||||||
enabled := m.config.Enabled
|
|
||||||
identityTemp := m.config.HighTemp
|
|
||||||
m.configMutex.RUnlock()
|
|
||||||
|
|
||||||
if !enabled && targetTemp == identityTemp && m.controlsInitialized {
|
|
||||||
m.post(func() {
|
|
||||||
log.Info("Destroying gamma controls after transition to identity")
|
|
||||||
m.outputs.Range(func(id uint32, out *outputState) bool {
|
|
||||||
if out.gammaControl != nil {
|
|
||||||
control := out.gammaControl.(*wlr_gamma_control.ZwlrGammaControlV1)
|
|
||||||
control.Destroy()
|
|
||||||
log.Debugf("Destroyed gamma control for output %d", id)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
m.outputs.Range(func(key uint32, value *outputState) bool {
|
|
||||||
m.outputs.Delete(key)
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
m.controlsInitialized = false
|
|
||||||
|
|
||||||
m.transitionMutex.Lock()
|
|
||||||
m.currentTemp = identityTemp
|
|
||||||
m.targetTemp = identityTemp
|
|
||||||
m.transitionMutex.Unlock()
|
|
||||||
|
|
||||||
log.Info("All gamma controls destroyed")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1258,42 +1227,33 @@ func (m *Manager) SetEnabled(enabled bool) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if m.controlsInitialized {
|
if m.controlsInitialized {
|
||||||
m.configMutex.RLock()
|
m.post(func() {
|
||||||
identityTemp := m.config.HighTemp
|
log.Info("Disabling gamma, destroying controls immediately")
|
||||||
m.configMutex.RUnlock()
|
m.outputs.Range(func(id uint32, out *outputState) bool {
|
||||||
|
if out.gammaControl != nil {
|
||||||
m.transitionMutex.RLock()
|
control := out.gammaControl.(*wlr_gamma_control.ZwlrGammaControlV1)
|
||||||
currentTemp := m.currentTemp
|
control.Destroy()
|
||||||
m.transitionMutex.RUnlock()
|
log.Debugf("Destroyed gamma control for output %d", id)
|
||||||
|
}
|
||||||
if currentTemp == identityTemp {
|
return true
|
||||||
m.post(func() {
|
|
||||||
log.Infof("Already at %dK, destroying gamma controls immediately", identityTemp)
|
|
||||||
m.outputs.Range(func(id uint32, out *outputState) bool {
|
|
||||||
if out.gammaControl != nil {
|
|
||||||
control := out.gammaControl.(*wlr_gamma_control.ZwlrGammaControlV1)
|
|
||||||
control.Destroy()
|
|
||||||
log.Debugf("Destroyed gamma control for output %d", id)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
m.outputs.Range(func(key uint32, value *outputState) bool {
|
|
||||||
m.outputs.Delete(key)
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
m.controlsInitialized = false
|
|
||||||
|
|
||||||
m.transitionMutex.Lock()
|
|
||||||
m.currentTemp = identityTemp
|
|
||||||
m.targetTemp = identityTemp
|
|
||||||
m.transitionMutex.Unlock()
|
|
||||||
|
|
||||||
log.Info("All gamma controls destroyed")
|
|
||||||
})
|
})
|
||||||
} else {
|
m.outputs.Range(func(key uint32, value *outputState) bool {
|
||||||
log.Infof("Disabling: transitioning to %dK before destroying controls", identityTemp)
|
m.outputs.Delete(key)
|
||||||
m.startTransition(identityTemp)
|
return true
|
||||||
}
|
})
|
||||||
|
m.controlsInitialized = false
|
||||||
|
|
||||||
|
m.configMutex.RLock()
|
||||||
|
identityTemp := m.config.HighTemp
|
||||||
|
m.configMutex.RUnlock()
|
||||||
|
|
||||||
|
m.transitionMutex.Lock()
|
||||||
|
m.currentTemp = identityTemp
|
||||||
|
m.targetTemp = identityTemp
|
||||||
|
m.transitionMutex.Unlock()
|
||||||
|
|
||||||
|
log.Info("All gamma controls destroyed")
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user