aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorIkalco <[email protected]>2024-05-07 10:07:50 -0500
committerGitHub <[email protected]>2024-05-07 16:07:50 +0100
commit6ccc22194ca2d16bd7dc4b7263f897a547c50e6b (patch)
tree55f8ea4b83bb99d6e6816d004171dfecfa4a51cf /src
parentec092bd601d9d351ff6ca34bd97f12055b2a4dd9 (diff)
downloadHyprland-6ccc22194ca2d16bd7dc4b7263f897a547c50e6b.tar.gz
Hyprland-6ccc22194ca2d16bd7dc4b7263f897a547c50e6b.zip
xkb: check value correctly with xkb_state_layout_index_is_active() (#5925)
Diffstat (limited to 'src')
-rw-r--r--src/debug/HyprCtl.cpp2
-rw-r--r--src/devices/IKeyboard.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 6382e899..d6e8608f 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -1084,7 +1084,7 @@ std::string switchXKBLayoutRequest(eHyprCtlOutputFormat format, std::string requ
const auto LAYOUTS = xkb_keymap_num_layouts(PWLRKEYBOARD->keymap);
xkb_layout_index_t activeLayout = 0;
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;
activeLayout++;
diff --git a/src/devices/IKeyboard.cpp b/src/devices/IKeyboard.cpp
index 61b078fb..61c78f5b 100644
--- a/src/devices/IKeyboard.cpp
+++ b/src/devices/IKeyboard.cpp
@@ -36,7 +36,7 @@ void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) {
const auto PCONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
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);
CVarList keyboardLayouts(currentRules.layout, 0, ',');
@@ -103,7 +103,7 @@ std::string IKeyboard::getActiveLayout() {
const auto LAYOUTSNUM = xkb_keymap_num_layouts(KEYMAP);
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);
if (LAYOUTNAME)