Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions display/displayconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,17 +674,33 @@ func (s *SysScreenConfig) setMonitorConfigsOnlyOne(uuid string, configs SysMonit
s.OnlyOneMap[uuid] = &SysMonitorModeConfig{}
}

logger.Debug("OnlyOneConfig lenth:", len(configs))
// 如果多个屏幕的UUID一样,则保存所有配置,根据屏幕名称区分应该点亮哪一个
if len(configs) > 1 {
// 去除非使能的 monitor
var tmpCfg *SysMonitorConfig
isRepeat := false
mapCfg := make(map[string]bool)
for _, config := range configs {
if config.Enabled {
tmpCfg = config
_, ok := mapCfg[config.UUID]
if ok {
logger.Debug("config uuid is repeat")
isRepeat = true
break
} else {
mapCfg[config.UUID] = true
}
}
if tmpCfg != nil {
configs = SysMonitorConfigs{tmpCfg}
if !isRepeat {
// 去除非使能的 monitor
var tmpCfg *SysMonitorConfig
for _, config := range configs {
if config.Enabled {
tmpCfg = config
break
}
}
if tmpCfg != nil {
configs = SysMonitorConfigs{tmpCfg}
}
}
}

Expand Down
8 changes: 7 additions & 1 deletion display/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,6 @@ func (m *Manager) buildConfigForModeOnlyOne(monitors Monitors, uuid string) (mon
//cfg.Reflect = 0
cfg.Brightness = 1
monitorCfgs = append(monitorCfgs, cfg)
return
}
}
return
Expand Down Expand Up @@ -1806,6 +1805,13 @@ func (m *Manager) applyModeOnlyOne(monitorsId monitorsId, monitorMap map[uint32]
}
}

if len(m.Monitors) > 1 && len(configs) > 1 && name != "" {
for _, config := range configs {
config.Enabled = config.Name == name
logger.Debug("update OnlyOneConfig", config)
}
}

err = m.applySysMonitorConfigs(DisplayModeOnlyOne, monitorsId, monitorMap, configs, options)
if err != nil {
return
Expand Down