Remove needs_key_repetition argument

Not supressing key repetition in backends seems like it was a bug, and
should be fixed as of https://github.com/Smithay/smithay/pull/1535.

So an argument for this should be unnecessary now.
This commit is contained in:
Ian Douglas Scott 2024-09-18 13:20:17 -07:00 committed by Victoria Brekenfeld
parent 6d017225e4
commit d7ca0324c5
4 changed files with 31 additions and 46 deletions

View file

@ -165,7 +165,7 @@ fn init_libinput(
state.backend.kms().input_devices.remove(device.name()); state.backend.kms().input_devices.remove(device.name());
} }
state.process_input_event(event, true); state.process_input_event(event);
for output in state.common.shell.read().unwrap().outputs() { for output in state.common.shell.read().unwrap().outputs() {
state.backend.kms().schedule_render(output); state.backend.kms().schedule_render(output);

View file

@ -320,7 +320,7 @@ impl State {
render_ping.ping(); render_ping.ping();
} }
WinitEvent::Redraw => render_ping.ping(), WinitEvent::Redraw => render_ping.ping(),
WinitEvent::Input(event) => self.process_input_event(event, false), WinitEvent::Input(event) => self.process_input_event(event),
WinitEvent::CloseRequested => { WinitEvent::CloseRequested => {
self.common.should_stop = true; self.common.should_stop = true;
} }

View file

@ -515,7 +515,7 @@ impl State {
_ => {} _ => {}
}; };
self.process_input_event(event, false); self.process_input_event(event);
// TODO actually figure out the output // TODO actually figure out the output
for output in self.common.shell.read().unwrap().outputs() { for output in self.common.shell.read().unwrap().outputs() {
self.backend.x11().schedule_render(output); self.backend.x11().schedule_render(output);

View file

@ -159,11 +159,8 @@ impl ModifiersShortcutQueue {
} }
impl State { impl State {
pub fn process_input_event<B: InputBackend>( pub fn process_input_event<B: InputBackend>(&mut self, event: InputEvent<B>)
&mut self, where
event: InputEvent<B>,
needs_key_repetition: bool,
) where
<B as InputBackend>::Device: 'static, <B as InputBackend>::Device: 'static,
{ {
use smithay::backend::input::Event; use smithay::backend::input::Event;
@ -226,13 +223,7 @@ impl State {
time, time,
|data, modifiers, handle| { |data, modifiers, handle| {
Self::filter_keyboard_input( Self::filter_keyboard_input(
data, data, &event, &seat, modifiers, handle, serial,
&event,
&seat,
modifiers,
handle,
serial,
needs_key_repetition,
) )
}, },
) )
@ -1439,7 +1430,6 @@ impl State {
modifiers: &ModifiersState, modifiers: &ModifiersState,
handle: KeysymHandle<'_>, handle: KeysymHandle<'_>,
serial: Serial, serial: Serial,
needs_key_repetition: bool,
) -> FilterResult<Option<(Action, shortcuts::Binding)>> { ) -> FilterResult<Option<(Action, shortcuts::Binding)>> {
let mut shell = self.common.shell.write().unwrap(); let mut shell = self.common.shell.write().unwrap();
@ -1567,36 +1557,31 @@ impl State {
} }
} }
} else { } else {
let token = if needs_key_repetition { let seat_clone = seat.clone();
let seat_clone = seat.clone(); let action_clone = action.clone();
let action_clone = action.clone(); let key_pattern_clone = key_pattern.clone();
let key_pattern_clone = key_pattern.clone(); let start = Instant::now();
let start = Instant::now(); let time = event.time_msec();
let time = event.time_msec(); let token = self
self.common .common
.event_loop_handle .event_loop_handle
.insert_source( .insert_source(
Timer::from_duration(Duration::from_millis(200)), Timer::from_duration(Duration::from_millis(200)),
move |current, _, state| { move |current, _, state| {
let duration = current.duration_since(start).as_millis(); let duration = current.duration_since(start).as_millis();
state.handle_action( state.handle_action(
action_clone.clone(), action_clone.clone(),
&seat_clone, &seat_clone,
serial, serial,
time.overflowing_add(duration as u32).0, time.overflowing_add(duration as u32).0,
key_pattern_clone.clone(), key_pattern_clone.clone(),
None, None,
true, true,
); );
calloop::timer::TimeoutAction::ToDuration( calloop::timer::TimeoutAction::ToDuration(Duration::from_millis(25))
Duration::from_millis(25), },
) )
}, .ok();
)
.ok()
} else {
None
};
seat.supressed_keys().add(&handle, token); seat.supressed_keys().add(&handle, token);
} }