Skip to content

Commit

Permalink
fix: unless sending of idle state (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonbrad authored Apr 24, 2024
1 parent 0367118 commit fcb7721
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,6 @@ pub fn run(

// We process event.
for event in event_rx.iter() {
// Consult the frontend to know if there have some requests.
frontend_tx1.send(GUICmd::NOP)?;
match frontend_rx2.recv()? {
GUICmd::End => break,
GUICmd::State(state) => {
if state {
rdev::simulate(&EventType::KeyPress(E_Key::Pause)).unwrap();
} else {
rdev::simulate(&EventType::KeyRelease(E_Key::Pause)).unwrap();
}
}
_ => (),
}

match event.event_type {
// Handling of idle state.
EventType::KeyPress(E_Key::Pause) => {
Expand Down Expand Up @@ -196,6 +182,17 @@ pub fn run(
}
};
}

// Consult the frontend to know if there have some requests.
frontend_tx1.send(GUICmd::NOP)?;
match frontend_rx2.recv()? {
GUICmd::End => break,
GUICmd::State(state) => {
idle = state;
frontend_tx1.send(GUICmd::State(idle))?;
}
_ => (),
}
}

// Wait the frontend to end properly.
Expand Down

0 comments on commit fcb7721

Please sign in to comment.