Skip to content

Commit 1e7ab0c

Browse files
committed
wayland: handle wl_seat v10 repeated state
Fixes #4382.
1 parent c333003 commit 1e7ab0c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

deny.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ crate = "android-activity"
5959
allow-globs = ["ci/*", "githooks/*"]
6060
crate = "zerocopy"
6161

62+
[[bans.build.bypass]]
63+
allow-globs = ["cherry-pick-stable.sh"]
64+
crate = "libc"
65+
6266
[[bans.build.bypass]]
6367
allow-globs = ["freetype2/*"]
6468
crate = "freetype-sys"

winit-wayland/src/seat/keyboard/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,23 @@ impl Dispatch<WlKeyboard, KeyboardData, WinitState> for WinitState {
129129
state.events_sink.push_window_event(WindowEvent::Focused(false), window_id);
130130
}
131131
},
132-
WlKeyboardEvent::Key { key, state: WEnum::Value(WlKeyState::Pressed), .. } => {
132+
WlKeyboardEvent::Key { key, state: WEnum::Value(key_state), .. }
133+
if matches!(key_state, WlKeyState::Repeated | WlKeyState::Pressed) =>
134+
{
133135
let key = key + 8;
134-
135136
key_input(
136137
keyboard_state,
137138
&mut state.events_sink,
138139
data,
139140
key,
140141
ElementState::Pressed,
141-
false,
142+
key_state == WlKeyState::Repeated,
142143
);
143144

144145
let delay = match keyboard_state.repeat_info {
145146
RepeatInfo::Repeat { delay, .. } => delay,
147+
// When compositor handles repeat, and thus we have `repeat = true`, we have
148+
// repeat on our side disabled, if it's not true, it's a compositor bug.
146149
RepeatInfo::Disable => return,
147150
};
148151

0 commit comments

Comments
 (0)