Skip to content

Commit

Permalink
Change the widget that triggers enter/left event
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu-Wei Wu committed Dec 2, 2021
1 parent b738857 commit 96251ee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/platform_impl/linux/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ impl<T: 'static> EventLoop<T> {
};
}
WindowRequest::WireUpEvents => {
let vbox = window.children().pop().unwrap().downcast::<gtk::Box>().unwrap();
// Resizing `decorations: false` aka borderless
window.add_events(
EventMask::POINTER_MOTION_MASK
Expand Down Expand Up @@ -430,7 +431,7 @@ impl<T: 'static> EventLoop<T> {
});

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 {
Expand Down Expand Up @@ -463,7 +464,7 @@ impl<T: 'static> EventLoop<T> {
});

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 {
Expand Down

0 comments on commit 96251ee

Please sign in to comment.