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
15 changes: 14 additions & 1 deletion display1/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2022-2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -40,7 +40,20 @@ func getCfgDir() string {
}

func updateSysMonitorConfigsName(configs SysMonitorConfigs, monitorMap map[uint32]*Monitor) {
// 同 EDID 的历史配置可能让多条记录共享同一个 UUID。
// 此时不能再按 UUID 覆盖 Name,否则多条记录的 Name 会被写成同一个输出名,
// 后续按 (UUID, Name) 区分显示器的能力就会被破坏。
uuidCount := make(map[string]int, len(configs))
for _, mc := range configs {
uuidCount[mc.UUID]++
}

for _, mc := range configs {
if uuidCount[mc.UUID] > 1 {
// UUID 有歧义时保留原 Name(包括空值),不能猜测并覆盖,
// 否则多条记录可能被写成同一个输出名。
continue
}
for _, m := range monitorMap {
if mc.UUID == m.uuid {
mc.Name = m.Name
Expand Down
Loading