diff --git a/src/main.rs b/src/main.rs index 994dcc7..2235a68 100644 --- a/src/main.rs +++ b/src/main.rs @@ -48,7 +48,7 @@ fn main() -> anyhow::Result<()> { state.dbus_server.poll(&mut state.wayland_state)?; } if fds[1].revents != 0 || state.wayland_state.color_changed() { - state = wayland.poll(state)?; + wayland.poll(&mut state)?; } } } else { @@ -72,7 +72,7 @@ fn main() -> anyhow::Result<()> { state.dbus_server.poll(&mut state.wayland_state)?; } if fds[1].revents != 0 || state.wayland_state.color_changed() { - state = wayland.poll(state)?; + wayland.poll(&mut state)?; } if fds[2].revents != 0 { dbus_client.run(false)?; diff --git a/src/wayland.rs b/src/wayland.rs index 7752aca..28daea6 100644 --- a/src/wayland.rs +++ b/src/wayland.rs @@ -48,9 +48,9 @@ impl Wayland { Ok((Self { conn }, state)) } - pub fn poll(&mut self, mut state: State) -> Result { + pub fn poll(&mut self, state: &mut State) -> Result<()> { match self.conn.recv_events(IoMode::NonBlocking) { - Ok(()) => self.conn.dispatch_events(&mut state), + Ok(()) => self.conn.dispatch_events(state), Err(e) if e.kind() == ErrorKind::WouldBlock => (), Err(e) => return Err(e.into()), } @@ -61,7 +61,7 @@ impl Wayland { } } self.conn.flush(IoMode::Blocking)?; - Ok(state) + Ok(()) } }