diff --git a/examples/open_window.rs b/examples/open_window.rs index ff64ccc..2f22de9 100644 --- a/examples/open_window.rs +++ b/examples/open_window.rs @@ -16,13 +16,13 @@ struct MyProgram {} impl WindowHandler for MyProgram { type Message = (); - fn build(window: &mut Window) -> Self { + fn build(_window: &mut Window) -> Self { Self {} } - fn draw(&mut self, _window: &mut Window) {} + fn on_frame(&mut self) {} - fn on_event(&mut self, window: &mut Window, event: Event) { + fn on_event(&mut self, _window: &mut Window, event: Event) { match event { Event::CursorMotion(x, y) => { println!("Cursor moved, x: {}, y: {}", x, y); @@ -63,5 +63,5 @@ impl WindowHandler for MyProgram { } } - fn on_message(&mut self, window: &mut Window, _message: Self::Message) {} + fn on_message(&mut self, _window: &mut Window, _message: Self::Message) {} } diff --git a/src/lib.rs b/src/lib.rs index c4ed84f..9cae115 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,7 +38,7 @@ pub trait WindowHandler { fn build(window: &mut Window) -> Self; - fn draw(&mut self, window: &mut Window); + fn on_frame(&mut self); fn on_event(&mut self, window: &mut Window, event: Event); fn on_message(&mut self, window: &mut Window, message: Self::Message); } diff --git a/src/x11/window.rs b/src/x11/window.rs index 807d59f..1553c34 100644 --- a/src/x11/window.rs +++ b/src/x11/window.rs @@ -135,7 +135,7 @@ impl Window { let now = Instant::now(); let until_next_frame = if now > next_frame { - handler.draw(self); + handler.on_frame(); next_frame = now + self.frame_interval; self.frame_interval @@ -188,7 +188,7 @@ impl Window { match event_type { xcb::EXPOSE => { - handler.draw(self); + handler.on_frame(); } xcb::MOTION_NOTIFY => { let event = unsafe { xcb::cast_event::(&event) };