mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
core: add test coverage for some of the wayland stack
- mostly targeting any race issue detection
This commit is contained in:
@@ -268,31 +268,36 @@ func (m *Manager) setupOutputControls(outputs []*wlclient.Output, manager *wlr_g
|
||||
}
|
||||
|
||||
func (m *Manager) setupControlHandlers(state *outputState, control *wlr_gamma_control.ZwlrGammaControlV1) {
|
||||
outputID := state.id
|
||||
|
||||
control.SetGammaSizeHandler(func(e wlr_gamma_control.ZwlrGammaControlV1GammaSizeEvent) {
|
||||
if out, ok := m.outputs.Load(state.id); ok {
|
||||
out.rampSize = e.Size
|
||||
out.failed = false
|
||||
out.retryCount = 0
|
||||
}
|
||||
size := e.Size
|
||||
m.post(func() {
|
||||
if out, ok := m.outputs.Load(outputID); ok {
|
||||
out.rampSize = size
|
||||
out.failed = false
|
||||
out.retryCount = 0
|
||||
}
|
||||
m.applyCurrentTemp()
|
||||
})
|
||||
})
|
||||
|
||||
control.SetFailedHandler(func(_ wlr_gamma_control.ZwlrGammaControlV1FailedEvent) {
|
||||
out, ok := m.outputs.Load(state.id)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
out.failed = true
|
||||
out.rampSize = 0
|
||||
out.retryCount++
|
||||
out.lastFailTime = time.Now()
|
||||
m.post(func() {
|
||||
out, ok := m.outputs.Load(outputID)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
out.failed = true
|
||||
out.rampSize = 0
|
||||
out.retryCount++
|
||||
out.lastFailTime = time.Now()
|
||||
|
||||
backoff := time.Duration(300<<uint(min(out.retryCount-1, 4))) * time.Millisecond
|
||||
time.AfterFunc(backoff, func() {
|
||||
m.post(func() {
|
||||
m.recreateOutputControl(out)
|
||||
backoff := time.Duration(300<<uint(min(out.retryCount-1, 4))) * time.Millisecond
|
||||
time.AfterFunc(backoff, func() {
|
||||
m.post(func() {
|
||||
m.recreateOutputControl(out)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -583,7 +588,7 @@ func (m *Manager) schedulerLoop() {
|
||||
m.configMutex.RUnlock()
|
||||
|
||||
if enabled {
|
||||
m.applyCurrentTemp()
|
||||
m.post(func() { m.applyCurrentTemp() })
|
||||
}
|
||||
|
||||
var timer *time.Timer
|
||||
@@ -625,14 +630,14 @@ func (m *Manager) schedulerLoop() {
|
||||
enabled := m.config.Enabled
|
||||
m.configMutex.RUnlock()
|
||||
if enabled {
|
||||
m.applyCurrentTemp()
|
||||
m.post(func() { m.applyCurrentTemp() })
|
||||
}
|
||||
case <-timer.C:
|
||||
m.configMutex.RLock()
|
||||
enabled := m.config.Enabled
|
||||
m.configMutex.RUnlock()
|
||||
if enabled {
|
||||
m.applyCurrentTemp()
|
||||
m.post(func() { m.applyCurrentTemp() })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user