From 96251eeac73433a03aa3a317e6327717e8a1fb9e Mon Sep 17 00:00:00 2001 From: Yu-Wei Wu Date: Thu, 2 Dec 2021 14:49:42 +0800 Subject: [PATCH] Change the widget that triggers enter/left event --- src/platform_impl/linux/event_loop.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/platform_impl/linux/event_loop.rs b/src/platform_impl/linux/event_loop.rs index 105562769c..070c029e19 100644 --- a/src/platform_impl/linux/event_loop.rs +++ b/src/platform_impl/linux/event_loop.rs @@ -286,6 +286,7 @@ impl EventLoop { }; } WindowRequest::WireUpEvents => { + let vbox = window.children().pop().unwrap().downcast::().unwrap(); // Resizing `decorations: false` aka borderless window.add_events( EventMask::POINTER_MOTION_MASK @@ -430,7 +431,7 @@ impl EventLoop { }); let tx_clone = event_tx.clone(); - window.connect_enter_notify_event(move |_, _| { + vbox.connect_enter_notify_event(move |_, _| { if let Err(e) = tx_clone.send(Event::WindowEvent { window_id: RootWindowId(id), event: WindowEvent::CursorEntered { @@ -463,7 +464,7 @@ impl EventLoop { }); let tx_clone = event_tx.clone(); - window.connect_leave_notify_event(move |_, _| { + vbox.connect_leave_notify_event(move |_, _| { if let Err(e) = tx_clone.send(Event::WindowEvent { window_id: RootWindowId(id), event: WindowEvent::CursorLeft {