Customisable, minimalist screen locker for Wayland
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(event): remove state changed event

state changed event was used as part of auth callback, which is
no longer present

+2 -19
+2 -16
src/event.rs
··· 22 22 pub enum EventType { 23 23 Wayland = 0, 24 24 KeyboardRepeat = 1, 25 - StateChanged = 2, 26 - AuthStateChanged = 3, 25 + AuthStateChanged = 2, 27 26 } 28 27 29 28 impl EventType { ··· 31 30 match value { 32 31 0 => Ok(Self::Wayland), 33 32 1 => Ok(Self::KeyboardRepeat), 34 - 2 => Ok(Self::StateChanged), 35 - 3 => Ok(Self::AuthStateChanged), 33 + 2 => Ok(Self::AuthStateChanged), 36 34 37 35 _ => Err(anyhow!("Invalid EventType value")), 38 36 } ··· 82 80 fn setup_poll(&mut self) -> Result<()> { 83 81 let poll = Poll::new()?; 84 82 85 - // Register the state event file descriptor 86 - poll.registry().register( 87 - &mut SourceFd(&self.state_ev.as_raw_fd()), 88 - Token(EventType::StateChanged as usize), 89 - Interest::READABLE, 90 - )?; 91 - 92 83 // Register the auth response file descriptor 93 84 poll.registry().register( 94 85 &mut SourceFd(&self.auth_comm.response.rx().as_raw_fd()), ··· 156 147 } 157 148 } 158 149 } 159 - } 160 - EventType::StateChanged => { 161 - // Read whatever is stored in there, we don't care what 162 - let mut buf = [0u8; std::mem::size_of::<u64>()]; 163 - let _ = read(self.state_ev.clone(), &mut buf)?; 164 150 } 165 151 EventType::AuthStateChanged => match self.auth_comm.response.read() { 166 152 Ok(true) => {
-3
src/state.rs
··· 11 11 use cairo::ImageSurface; 12 12 use gdk_pixbuf::Pixbuf; 13 13 use mio::Poll; 14 - use nix::sys::eventfd::EventFd; 15 14 use nix::sys::timerfd::TimerFd; 16 15 use tracing::{debug, warn}; 17 16 use wayland_client::protocol::{wl_region, wl_subcompositor, wl_subsurface}; ··· 64 63 pub timers: Vec<(TimerFd, usize)>, 65 64 pub auth_comm: Arc<AuthChannel>, 66 65 pub auth_state: Arc<AtomicAuthState>, 67 - pub state_ev: Arc<EventFd>, 68 66 pub background_image: Option<cairo::ImageSurface>, 69 67 } 70 68 ··· 96 94 timers: Vec::new(), 97 95 auth_comm, 98 96 auth_state: Arc::new(AtomicAuthState::new(AuthState::Idle)), 99 - state_ev: Arc::new(EventFd::new()?), 100 97 background_image: None, 101 98 }; 102 99