Skip to content

Commit

Permalink
Fix message loop
Browse files Browse the repository at this point in the history
  • Loading branch information
sop committed Sep 17, 2019
1 parent 55dec5f commit b90d8a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ impl MainWindow {
fn run(&self) -> Result<(), Error> {
loop {
let mut msg: MSG = unsafe { zeroed() };
match unsafe { GetMessageW(&mut msg, self.window, 0, 0) } {
x if x > 0 => {
match unsafe { GetMessageW(&mut msg, null_mut(), 0, 0) } {
1..=std::i32::MAX => {
unsafe { TranslateMessage(&msg) };
unsafe { DispatchMessageW(&msg) };
}
x if x < 0 => Err(last_error())?,
_ => break,
std::i32::MIN..=-1 => Err(last_error())?,
0 => break,
}
}
Ok(())
Expand Down

0 comments on commit b90d8a0

Please sign in to comment.