Skip to content

Commit 0e846e1

Browse files
authored
fix(wayland): bypass key events when input not activated (#745)
* fix(wayland): bypass key events when input not activated When grab_activate is false, key press events were not being forwarded to the compositor, causing shortcuts and input to stop working in apps like Firefox, rofi, hyprlock, wlogout on wlroots-based compositors (Niri, Hyprland). Fixes key handling to match previous behavior: - V2: forward all keys via vk.key() when not activated - V1: forward all keys via key_v1() when not activated * add CHANGELOG * Update CHANGELOG * fix logic more simple
1 parent 0179318 commit 0e846e1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/frontends/wayland/src/state.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,8 @@ impl Dispatch<ZwpInputMethodKeyboardGrabV2, ()> for AppState {
684684
if let Some(ref im_state) = state.im_v2 {
685685
im_state.vk.key(time, key, key_state.into());
686686
}
687-
} else if !is_pressed {
687+
} else {
688+
// is_pressed && !grab_activate - bypass
688689
if let Some(ref im_state) = state.im_v2 {
689690
im_state.vk.key(time, key, key_state.into());
690691
}
@@ -901,8 +902,11 @@ impl Dispatch<WlKeyboard, ()> for AppState {
901902
*press_state = PressState::NotPressing;
902903
}
903904
}
904-
state.key_v1(time, key, KeyState::Released);
905+
if let WEnum::Value(ks) = key_state {
906+
state.key_v1(time, key, ks);
907+
}
905908
} else if let WEnum::Value(ks) = key_state {
909+
// is_pressed && !grab_activate - bypass
906910
state.key_v1(time, key, ks);
907911
}
908912
}

0 commit comments

Comments
 (0)