x11: Call ApplicationHandler directly
Instead of going through the Event enum.
This commit is contained in:
parent
f290619dce
commit
f9912baf09
3 changed files with 225 additions and 391 deletions
|
|
@ -24,7 +24,7 @@ use x11rb::xcb_ffi::ReplyOrIdError;
|
|||
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::error::{EventLoopError, RequestError};
|
||||
use crate::event::{DeviceId, Event, StartCause, WindowEvent};
|
||||
use crate::event::{DeviceId, StartCause, WindowEvent};
|
||||
use crate::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as CoreEventLoopProxy, EventLoopProxyProvider,
|
||||
|
|
@ -574,22 +574,7 @@ impl EventLoop {
|
|||
|
||||
while unsafe { self.event_processor.poll_one_event(xev.as_mut_ptr()) } {
|
||||
let mut xev = unsafe { xev.assume_init() };
|
||||
self.event_processor.process_event(&mut xev, |window_target, event: Event| {
|
||||
if let Event::WindowEvent { window_id, event: WindowEvent::RedrawRequested } = event
|
||||
{
|
||||
window_target.redraw_sender.send(window_id);
|
||||
} else {
|
||||
match event {
|
||||
Event::WindowEvent { window_id, event } => {
|
||||
app.window_event(window_target, window_id, event)
|
||||
},
|
||||
Event::DeviceEvent { device_id, event } => {
|
||||
app.device_event(window_target, device_id, event)
|
||||
},
|
||||
_ => unreachable!("event which is neither device nor window event."),
|
||||
}
|
||||
}
|
||||
});
|
||||
self.event_processor.process_event(&mut xev, app);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue