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:
parent
0e52672f4a
commit
f3f6f1008a
19 changed files with 324 additions and 271 deletions
|
|
@ -16,8 +16,11 @@ pub struct EventLoop<T: 'static> {
|
|||
elw: root::EventLoopWindowTarget<T>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Copy, Clone, PartialEq, Hash)]
|
||||
pub(crate) struct PlatformSpecificEventLoopAttributes {}
|
||||
|
||||
impl<T> EventLoop<T> {
|
||||
pub fn new() -> Self {
|
||||
pub(crate) fn new(_: &PlatformSpecificEventLoopAttributes) -> Self {
|
||||
EventLoop {
|
||||
elw: root::EventLoopWindowTarget {
|
||||
p: WindowTarget::new(),
|
||||
|
|
|
|||
|
|
@ -28,8 +28,9 @@ mod backend;
|
|||
|
||||
pub use self::device::Id as DeviceId;
|
||||
pub use self::error::OsError;
|
||||
pub use self::event_loop::{
|
||||
EventLoop, Proxy as EventLoopProxy, WindowTarget as EventLoopWindowTarget,
|
||||
pub(crate) use self::event_loop::{
|
||||
EventLoop, PlatformSpecificEventLoopAttributes, Proxy as EventLoopProxy,
|
||||
WindowTarget as EventLoopWindowTarget,
|
||||
};
|
||||
pub use self::monitor::{Handle as MonitorHandle, Mode as VideoMode};
|
||||
pub use self::window::{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue