bugfix: mouse events were not being registered.

- Mouse events and Window Events should be sent seperately, they were
being sent only as WindowEvents which made bevy not react to mouse
events.
This commit is contained in:
Naman Agrawal
2025-08-22 16:03:10 +05:30
parent b368d43531
commit e98d52a57f
2 changed files with 23 additions and 5 deletions
+22 -3
View File
@@ -7,9 +7,7 @@ use bevy::{
window::{CursorEntered, CursorLeft, CursorMoved, Window, WindowEvent},
};
use smithay_client_toolkit::{
delegate_pointer,
reexports::{client::Proxy, csd_frame::WindowState},
seat::pointer::PointerHandler,
delegate_pointer, reexports::client::Proxy, seat::pointer::PointerHandler,
};
use crate::{surface_handler::WaylandSurfaces, WaylandState};
@@ -101,6 +99,27 @@ impl PointerHandler for WaylandState {
.into(),
};
let window_event: WindowEvent = pointer_event;
match window_event.clone() {
WindowEvent::CursorEntered(e) => {
self.world_mut().send_event(e);
}
WindowEvent::CursorLeft(e) => {
self.world_mut().send_event(e);
}
WindowEvent::CursorMoved(e) => {
self.world_mut().send_event(e);
}
WindowEvent::MouseButtonInput(e) => {
self.world_mut().send_event(e);
}
WindowEvent::MouseMotion(e) => {
self.world_mut().send_event(e);
}
WindowEvent::MouseWheel(e) => {
self.world_mut().send_event(e);
}
_ => {}
}
self.world_mut().send_event::<WindowEvent>(window_event);
}
}