From 475bd5f88a2e2ea72601039f69b68c0380c9d9e0 Mon Sep 17 00:00:00 2001 From: Fredemus Date: Sat, 28 Oct 2023 17:35:26 +0200 Subject: [PATCH] remove unneeded allocation --- src/win/window.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/win/window.rs b/src/win/window.rs index 7959ad7c..0a92ba80 100644 --- a/src/win/window.rs +++ b/src/win/window.rs @@ -182,15 +182,15 @@ unsafe fn wnd_proc_inner( if *mouse_was_outside_window { // this makes Windows track whether the mouse leaves the window. // When the mouse leaves it results in a `WM_MOUSELEAVE` event. - let track_mouse = Rc::new(TRACKMOUSEEVENT { + let mut track_mouse =TRACKMOUSEEVENT { cbSize: std::mem::size_of::() as u32, dwFlags: winapi::um::winuser::TME_LEAVE, hwndTrack: hwnd, dwHoverTime: winapi::um::winuser::HOVER_DEFAULT, - }); + }; // Couldn't find a good way to track whether the mouse enters, // but if `WM_MOUSEMOVE` happens, the mouse must have entered. - TrackMouseEvent(Rc::as_ptr(&track_mouse) as winapi::um::winuser::LPTRACKMOUSEEVENT); + TrackMouseEvent(&mut track_mouse); *mouse_was_outside_window = false; let enter_event = Event::Mouse(MouseEvent::CursorEntered);