From 085a6e32c60f2e0094e50020b306f88de071a243 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 2 Mar 2025 17:37:14 +0100 Subject: [PATCH] inputd: Unify early and non-early handle opening --- inputd/src/main.rs | 51 ++++++++++++++-------------------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/inputd/src/main.rs b/inputd/src/main.rs index 44fb836074..adbfe671c4 100644 --- a/inputd/src/main.rs +++ b/inputd/src/main.rs @@ -146,45 +146,23 @@ impl Scheme for InputScheme { vt: target, } } - "handle_early" => { + "handle" | "handle_early" => { let display = path_parts.collect::>().join("."); - if self.display.is_none() { - self.has_new_events = true; - self.display = Some(display.clone()); - for handle in self.handles.values_mut() { - match handle { - Handle::Consumer { - needs_handoff, - notified, + let needs_handoff = match command { + "handle_early" => self.display.is_none(), + "handle" => self.handles.values().all(|handle| { + !matches!( + handle, + Handle::Display { + is_earlyfb: false, .. - } => { - *needs_handoff = true; - *notified = false; } - _ => continue, - } - } - } - Handle::Display { - events: EventFlags::empty(), - pending: Vec::new(), - notified: false, - device: display, - is_earlyfb: true, - } - } - "handle" => { - let display = path_parts.collect::>().join("."); - let needs_handoff = self.handles.values().all(|handle| { - !matches!( - handle, - Handle::Display { - is_earlyfb: false, - .. - } - ) - }); + ) + }), + _ => unreachable!(), + }; + if needs_handoff { self.has_new_events = true; self.display = Some(display.clone()); @@ -203,6 +181,7 @@ impl Scheme for InputScheme { } } } + Handle::Display { events: EventFlags::empty(), pending: if let Some(active_vt) = self.active_vt { @@ -218,7 +197,7 @@ impl Scheme for InputScheme { }, notified: false, device: display, - is_earlyfb: false, + is_earlyfb: command == "handle_early", } } "control" => Handle::Control,