diff options
| author | 2021-07-20 21:44:33 +0700 | |
|---|---|---|
| committer | 2021-07-20 21:44:33 +0700 | |
| commit | 8e29709b69ec0eae211887c8c6d91558175997b5 (patch) | |
| tree | c6fe2b40d4be34867e61b9061d27ae44916ad4ab /glutin | |
| parent | a6dbaf0f5fd3590a8cfe92f924184c5d78e00152 (diff) | |
| parent | 82db3c78b6cfa2cc55ece6ffa46811bfb5195f60 (diff) | |
| download | iced-8e29709b69ec0eae211887c8c6d91558175997b5.tar.gz iced-8e29709b69ec0eae211887c8c6d91558175997b5.tar.bz2 iced-8e29709b69ec0eae211887c8c6d91558175997b5.zip | |
Merge pull request #945 from derezzedex/menu
feat: add menus
Diffstat (limited to '')
| -rw-r--r-- | glutin/Cargo.toml | 2 | ||||
| -rw-r--r-- | glutin/src/application.rs | 23 | 
2 files changed, 19 insertions, 6 deletions
| diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml index 78d5fe47..b2a7f307 100644 --- a/glutin/Cargo.toml +++ b/glutin/Cargo.toml @@ -16,7 +16,7 @@ debug = ["iced_winit/debug"]  [dependencies.glutin]  version = "0.27"  git = "https://github.com/iced-rs/glutin" -rev = "2564d0ab87cf2ad824a2a58733aebe40dd2f29bb" +rev = "03437d8a1826d83c62017b2bb7bf18bfc9e352cc"  [dependencies.iced_native]  version = "0.4" diff --git a/glutin/src/application.rs b/glutin/src/application.rs index a8e5dbf9..991c8705 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -52,11 +52,14 @@ where      runtime.track(subscription);      let context = { -        let builder = settings.window.into_builder( -            &application.title(), -            application.mode(), -            event_loop.primary_monitor(), -        ); +        let builder = settings +            .window +            .into_builder( +                &application.title(), +                application.mode(), +                event_loop.primary_monitor(), +            ) +            .with_menu(Some(conversion::menu(&application.menu())));          let context = ContextBuilder::new()              .with_vsync(true) @@ -304,6 +307,16 @@ async fn run_instance<A, E, C>(                  // Maybe we can use `ControlFlow::WaitUntil` for this.              }              event::Event::WindowEvent { +                event: event::WindowEvent::MenuEntryActivated(entry_id), +                .. +            } => { +                if let Some(message) = +                    conversion::menu_message(state.menu(), entry_id) +                { +                    messages.push(message); +                } +            } +            event::Event::WindowEvent {                  event: window_event,                  ..              } => { | 
