Fixed enable/disable module issue for conflict

Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
This commit is contained in:
Shuai Yuan
2025-07-07 16:02:40 +08:00
parent 63257e928d
commit a5f140df17

View File

@@ -271,6 +271,8 @@ namespace HotkeyConflictDetector
for (auto it = inAppConflictHotkeyMap.begin(); it != inAppConflictHotkeyMap.end();)
{
auto& conflictSet = it->second;
uint16_t handle = it->first;
for (auto setIt = conflictSet.begin(); setIt != conflictSet.end();)
{
if (setIt->moduleName == moduleName)
@@ -284,10 +286,18 @@ namespace HotkeyConflictDetector
++setIt;
}
}
if (conflictSet.empty())
{
it = inAppConflictHotkeyMap.erase(it);
}
else if (conflictSet.size() == 1)
{
// Move the only remaining conflict to main map
const auto& onlyConflict = *conflictSet.begin();
hotkeyMap[handle] = onlyConflict;
it = inAppConflictHotkeyMap.erase(it);
}
else
{
++it;