mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 07:03:15 -04:00
Add EventLoopBuilder
This commit adds an `EventLoopBuilder` struct to simplify event loop customization and providing options to it upon creation. It also deprecates the use of `EventLoop::with_user_event` in favor of the same method on new builder, and replaces old platforms specific extension traits with the new ones on the `EventLoopBuilder`.
This commit is contained in:
@@ -71,6 +71,9 @@ pub struct EventLoop<T: 'static> {
|
||||
running: bool,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Copy, Clone, PartialEq, Hash)]
|
||||
pub(crate) struct PlatformSpecificEventLoopAttributes {}
|
||||
|
||||
macro_rules! call_event_handler {
|
||||
( $event_handler:expr, $window_target:expr, $cf:expr, $event:expr ) => {{
|
||||
if let ControlFlow::ExitWithCode(code) = $cf {
|
||||
@@ -82,7 +85,7 @@ macro_rules! call_event_handler {
|
||||
}
|
||||
|
||||
impl<T: 'static> EventLoop<T> {
|
||||
pub fn new() -> Self {
|
||||
pub(crate) fn new(_: &PlatformSpecificEventLoopAttributes) -> Self {
|
||||
Self {
|
||||
window_target: event_loop::EventLoopWindowTarget {
|
||||
p: EventLoopWindowTarget {
|
||||
|
||||
Reference in New Issue
Block a user