Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check value correctly with xkb_state_layout_index_is_active() #5925

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/debug/HyprCtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
4 changes: 2 additions & 2 deletions src/devices/IKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, ',');
Expand Down Expand Up @@ -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)
Expand Down
Loading