mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 16:46:00 +01:00
parent
cc94123fa7
commit
c701767038
1 changed files with 16 additions and 3 deletions
|
@ -195,14 +195,27 @@ void SKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) {
|
||||||
|
|
||||||
std::string layout, model, variant;
|
std::string layout, model, variant;
|
||||||
layout = keyboardLayouts[i % keyboardLayouts.size()];
|
layout = keyboardLayouts[i % keyboardLayouts.size()];
|
||||||
model = keyboardModels[i % keyboardLayouts.size()];
|
model = keyboardModels[i % keyboardModels.size()];
|
||||||
variant = keyboardVariants[i % keyboardLayouts.size()];
|
variant = keyboardVariants[i % keyboardVariants.size()];
|
||||||
|
|
||||||
rules.layout = layout.c_str();
|
rules.layout = layout.c_str();
|
||||||
rules.model = model.c_str();
|
rules.model = model.c_str();
|
||||||
rules.variant = variant.c_str();
|
rules.variant = variant.c_str();
|
||||||
|
|
||||||
const auto KEYMAP = xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
auto KEYMAP = xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
|
||||||
|
if (!KEYMAP) {
|
||||||
|
Debug::log(ERR, "updateXKBTranslationState: keymap failed 1, fallback without model/variant");
|
||||||
|
rules.model = "";
|
||||||
|
rules.variant = "";
|
||||||
|
KEYMAP = xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!KEYMAP) {
|
||||||
|
Debug::log(ERR, "updateXKBTranslationState: keymap failed 2, fallback to us");
|
||||||
|
rules.layout = "us";
|
||||||
|
KEYMAP = xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
}
|
||||||
|
|
||||||
xkbTranslationState = xkb_state_new(KEYMAP);
|
xkbTranslationState = xkb_state_new(KEYMAP);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue