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.process_input_event(event, true);
state.process_input_event(event);
for output in state.common.shell.read().unwrap().outputs() {
state.backend.kms().schedule_render(output);

View file

@ -320,7 +320,7 @@ impl State {
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 => {
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
for output in self.common.shell.read().unwrap().outputs() {
self.backend.x11().schedule_render(output);

View file

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