From cb0aeb0db77cfa87394a99a3188c05a419d49e89 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 16 Jun 2020 14:42:13 +0200 Subject: [PATCH] Minor GenericWindow trait cleanup The trait functions don't need to consume an Rc, it turns out. --- sixtyfps_runtime/corelib/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sixtyfps_runtime/corelib/lib.rs b/sixtyfps_runtime/corelib/lib.rs index 4ad9c1d74..e34924eff 100644 --- a/sixtyfps_runtime/corelib/lib.rs +++ b/sixtyfps_runtime/corelib/lib.rs @@ -55,9 +55,9 @@ use std::cell::RefCell; use std::rc::{Rc, Weak}; trait GenericWindow { - fn draw(self: Rc, component: vtable::VRef); + fn draw(&self, component: vtable::VRef); fn process_mouse_input( - self: Rc, + &self, pos: winit::dpi::PhysicalPosition, state: winit::event::ElementState, component: vtable::VRef, @@ -114,7 +114,7 @@ impl Drop for MainWindow GenericWindow for RefCell> { - fn draw(self: Rc, component: vtable::VRef) { + fn draw(&self, component: vtable::VRef) { // FIXME: we should do that only if some property change component.compute_layout(); @@ -156,7 +156,7 @@ impl GenericWindow this.graphics_backend.present_frame(frame); } fn process_mouse_input( - self: Rc, + &self, pos: winit::dpi::PhysicalPosition, state: winit::event::ElementState, component: vtable::VRef, @@ -206,7 +206,7 @@ fn run_event_loop( if let Some(Some(window)) = windows.borrow().get(&id).map(|weakref| weakref.upgrade()) { - window.clone().draw(component); + window.draw(component); } }); } @@ -227,7 +227,7 @@ fn run_event_loop( if let Some(Some(window)) = windows.borrow().get(&window_id).map(|weakref| weakref.upgrade()) { - window.clone().process_mouse_input(cursor_pos, state, component); + window.process_mouse_input(cursor_pos, state, component); let window = window.window_handle(); // FIXME: remove this, it should be based on actual changes rather than this window.request_redraw();