FancyZones settings: show proper hotkey even when wrong key was saved before

This makes the Hotkey settings object ignore the key value stored in
json. Instead it will be deduced from the current keyboard layout and
the vk_code.
This commit is contained in:
Bartosz Sosnowski 2019-11-25 10:13:47 +01:00 committed by Bartosz Sosnowski
parent fbc922fe97
commit d6f0f9ec0e

View file

@ -166,7 +166,11 @@ namespace PowerToysSettings {
return output.data();
}
}
HotkeyObject(web::json::value hotkey_json) : m_json(hotkey_json) {};
HotkeyObject(web::json::value hotkey_json) : m_json(hotkey_json) {
if (m_json.has_number_field(L"code")) {
m_json.as_object()[L"key"] = web::json::value::string(key_from_code(get_code()));
}
};
web::json::value m_json;
};