mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 22:45:59 +01:00
xkb: check value correctly with xkb_state_layout_index_is_active() (#5925)
This commit is contained in:
parent
ec092bd601
commit
6ccc22194c
2 changed files with 3 additions and 3 deletions
|
@ -1084,7 +1084,7 @@ std::string switchXKBLayoutRequest(eHyprCtlOutputFormat format, std::string requ
|
||||||
const auto LAYOUTS = xkb_keymap_num_layouts(PWLRKEYBOARD->keymap);
|
const auto LAYOUTS = xkb_keymap_num_layouts(PWLRKEYBOARD->keymap);
|
||||||
xkb_layout_index_t activeLayout = 0;
|
xkb_layout_index_t activeLayout = 0;
|
||||||
while (activeLayout < LAYOUTS) {
|
while (activeLayout < LAYOUTS) {
|
||||||
if (xkb_state_layout_index_is_active(PWLRKEYBOARD->xkb_state, activeLayout, XKB_STATE_LAYOUT_EFFECTIVE))
|
if (xkb_state_layout_index_is_active(PWLRKEYBOARD->xkb_state, activeLayout, XKB_STATE_LAYOUT_EFFECTIVE) == 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
activeLayout++;
|
activeLayout++;
|
||||||
|
|
|
@ -36,7 +36,7 @@ void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) {
|
||||||
const auto PCONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
const auto PCONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < LAYOUTSNUM; ++i) {
|
for (uint32_t i = 0; i < LAYOUTSNUM; ++i) {
|
||||||
if (xkb_state_layout_index_is_active(STATE, i, XKB_STATE_LAYOUT_EFFECTIVE)) {
|
if (xkb_state_layout_index_is_active(STATE, i, XKB_STATE_LAYOUT_EFFECTIVE) == 1) {
|
||||||
Debug::log(LOG, "Updating keyboard {:x}'s translation state from an active index {}", (uintptr_t)this, i);
|
Debug::log(LOG, "Updating keyboard {:x}'s translation state from an active index {}", (uintptr_t)this, i);
|
||||||
|
|
||||||
CVarList keyboardLayouts(currentRules.layout, 0, ',');
|
CVarList keyboardLayouts(currentRules.layout, 0, ',');
|
||||||
|
@ -103,7 +103,7 @@ std::string IKeyboard::getActiveLayout() {
|
||||||
const auto LAYOUTSNUM = xkb_keymap_num_layouts(KEYMAP);
|
const auto LAYOUTSNUM = xkb_keymap_num_layouts(KEYMAP);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < LAYOUTSNUM; ++i) {
|
for (uint32_t i = 0; i < LAYOUTSNUM; ++i) {
|
||||||
if (xkb_state_layout_index_is_active(STATE, i, XKB_STATE_LAYOUT_EFFECTIVE)) {
|
if (xkb_state_layout_index_is_active(STATE, i, XKB_STATE_LAYOUT_EFFECTIVE) == 1) {
|
||||||
const auto LAYOUTNAME = xkb_keymap_layout_get_name(KEYMAP, i);
|
const auto LAYOUTNAME = xkb_keymap_layout_get_name(KEYMAP, i);
|
||||||
|
|
||||||
if (LAYOUTNAME)
|
if (LAYOUTNAME)
|
||||||
|
|
Loading…
Reference in a new issue