From b22b0dd7ff56d433c459e0d14e14eb5472a6224d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Mar 2021 01:16:26 +0100 Subject: Update `window_clipboard` to `0.2` --- glutin/src/application.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'glutin') diff --git a/glutin/src/application.rs b/glutin/src/application.rs index 42513feb..e6bb28e4 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -136,7 +136,7 @@ async fn run_instance( use glutin::event; use iced_winit::futures::stream::StreamExt; - let clipboard = Clipboard::new(context.window()); + let clipboard = Clipboard::connect(context.window()); let mut state = application::State::new(&application, context.window()); let mut viewport_version = state.viewport_version(); -- cgit From 21971e0037c2ddcb96fd48ea96332445de4137bb Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Mar 2021 01:59:02 +0100 Subject: Make `Clipboard` argument in `Widget` trait mutable --- glutin/src/application.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'glutin') diff --git a/glutin/src/application.rs b/glutin/src/application.rs index e6bb28e4..19eee219 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -136,7 +136,7 @@ async fn run_instance( use glutin::event; use iced_winit::futures::stream::StreamExt; - let clipboard = Clipboard::connect(context.window()); + let mut clipboard = Clipboard::connect(context.window()); let mut state = application::State::new(&application, context.window()); let mut viewport_version = state.viewport_version(); @@ -170,8 +170,8 @@ async fn run_instance( let statuses = user_interface.update( &events, state.cursor_position(), - clipboard.as_ref().map(|c| c as _), &mut renderer, + &mut clipboard, &mut messages, ); -- cgit From ae517b9fa033ba75df5fc6ce766698fab22504fa Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 11 Mar 2021 03:38:20 +0100 Subject: Add `clipboard` argument to `Application::update` --- glutin/src/application.rs | 1 + glutin/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'glutin') diff --git a/glutin/src/application.rs b/glutin/src/application.rs index 19eee219..3a08104e 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -190,6 +190,7 @@ async fn run_instance( &mut application, &mut runtime, &mut debug, + &mut clipboard, &mut messages, ); diff --git a/glutin/src/lib.rs b/glutin/src/lib.rs index f2c0102a..107d9556 100644 --- a/glutin/src/lib.rs +++ b/glutin/src/lib.rs @@ -17,7 +17,7 @@ pub use iced_native::*; pub mod application; pub use iced_winit::settings; -pub use iced_winit::{Error, Mode}; +pub use iced_winit::{Clipboard, Error, Mode}; #[doc(no_inline)] pub use application::Application; -- cgit From 2b520ca0984486d3ad930873837df8c819bab30c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 24 Mar 2021 05:29:19 +0100 Subject: Convert `ScaleFactorChanged` into `Resized` events in `iced_glutin` ... instead of just dropping them when calling `to_static`. --- glutin/src/application.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'glutin') diff --git a/glutin/src/application.rs b/glutin/src/application.rs index 3a08104e..163bc9f9 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -107,7 +107,22 @@ where return; } - if let Some(event) = event.to_static() { + let event = match event { + glutin::event::Event::WindowEvent { + event: + glutin::event::WindowEvent::ScaleFactorChanged { + new_inner_size, + .. + }, + window_id, + } => Some(glutin::event::Event::WindowEvent { + event: glutin::event::WindowEvent::Resized(*new_inner_size), + window_id, + }), + _ => event.to_static(), + }; + + if let Some(event) = event { sender.start_send(event).expect("Send event"); let poll = instance.as_mut().poll(&mut context); -- cgit From 67db13ff7c727254182a8c4474bd962b205e2e99 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 30 Mar 2021 21:44:19 +0200 Subject: Add support for graceful exits in `Application` - `Settings` now contains an `exit_on_close_request` field - `Application` has a new `should_exit` method --- glutin/src/application.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'glutin') diff --git a/glutin/src/application.rs b/glutin/src/application.rs index 163bc9f9..79fcf745 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -92,10 +92,11 @@ where application, compositor, renderer, - context, runtime, debug, receiver, + context, + settings.exit_on_close_request, )); let mut context = task::Context::from_waker(task::noop_waker_ref()); @@ -139,10 +140,11 @@ async fn run_instance( mut application: A, mut compositor: C, mut renderer: A::Renderer, - context: glutin::ContextWrapper, mut runtime: Runtime, A::Message>, mut debug: Debug, mut receiver: mpsc::UnboundedReceiver>, + context: glutin::ContextWrapper, + exit_on_close_request: bool, ) where A: Application + 'static, E: Executor + 'static, @@ -212,6 +214,8 @@ async fn run_instance( // Update window state.synchronize(&application, context.window()); + let should_exit = application.should_exit(); + user_interface = ManuallyDrop::new(application::build_user_interface( &mut application, @@ -220,6 +224,10 @@ async fn run_instance( state.logical_size(), &mut debug, )); + + if should_exit { + break; + } } debug.draw_started(); @@ -290,6 +298,7 @@ async fn run_instance( .. } => { if application::requests_exit(&window_event, state.modifiers()) + && exit_on_close_request { break; } -- cgit From 0864e63bde129b95261590b960efdc46c6d2d4d0 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 31 Mar 2021 20:06:03 +0200 Subject: Bump versions :tada: --- glutin/Cargo.toml | 8 ++++---- glutin/README.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'glutin') diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml index 505ee7e5..5d2c5be7 100644 --- a/glutin/Cargo.toml +++ b/glutin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iced_glutin" -version = "0.1.0" +version = "0.2.0" authors = ["Héctor Ramón Jiménez "] edition = "2018" description = "A glutin runtime for Iced" @@ -17,14 +17,14 @@ debug = ["iced_winit/debug"] glutin = "0.26" [dependencies.iced_native] -version = "0.3" +version = "0.4" path = "../native" [dependencies.iced_winit] -version = "0.2" +version = "0.3" path = "../winit" [dependencies.iced_graphics] -version = "0.1" +version = "0.2" path = "../graphics" features = ["opengl"] diff --git a/glutin/README.md b/glutin/README.md index addb9228..fcae157e 100644 --- a/glutin/README.md +++ b/glutin/README.md @@ -20,7 +20,7 @@ It exposes a renderer-agnostic `Application` trait that can be implemented and t Add `iced_glutin` as a dependency in your `Cargo.toml`: ```toml -iced_glutin = "0.1" +iced_glutin = "0.2" ``` __Iced moves fast and the `master` branch can contain breaking changes!__ If -- cgit From ba51661a2a7aa136d9c9d83f87df52ea60f7b51b Mon Sep 17 00:00:00 2001 From: Imbris Date: Tue, 15 Jun 2021 02:47:54 -0400 Subject: Bump winit to 0.25 --- glutin/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'glutin') diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml index 5d2c5be7..92aa5018 100644 --- a/glutin/Cargo.toml +++ b/glutin/Cargo.toml @@ -14,7 +14,7 @@ categories = ["gui"] debug = ["iced_winit/debug"] [dependencies] -glutin = "0.26" +glutin = "0.27" [dependencies.iced_native] version = "0.4" -- cgit From 9ae22b58d843d9a39212028478598c19a49bc2e6 Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 21 Apr 2021 17:52:31 -0300 Subject: Added events for url handling and create example --- glutin/src/application.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'glutin') diff --git a/glutin/src/application.rs b/glutin/src/application.rs index 79fcf745..55293b3b 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -237,6 +237,9 @@ async fn run_instance( context.window().request_redraw(); } + event::Event::ReceivedUrl(url) => { + events.push(iced_native::Event::UrlReceived(url)); + } event::Event::UserEvent(message) => { messages.push(message); } -- cgit From 96a462d2f2cb608ad14c93cc55896108a2dccb2b Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 9 Jun 2021 15:00:01 -0300 Subject: Use new enum variant and new winit repo --- glutin/src/application.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'glutin') diff --git a/glutin/src/application.rs b/glutin/src/application.rs index 55293b3b..22dff149 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -237,8 +237,9 @@ async fn run_instance( context.window().request_redraw(); } - event::Event::ReceivedUrl(url) => { - events.push(iced_native::Event::UrlReceived(url)); + event::Event::PlatformSpecific(event::PlatformSpecific::MacOS(event::MacOS::ReceivedUrl(url))) => { + use iced_native::event; + events.push(iced_native::Event::PlatformSpecific(event::PlatformSpecific::MacOS(event::MacOS::ReceivedUrl(url)))); } event::Event::UserEvent(message) => { messages.push(message); -- cgit From 612585109ffc9a14a507c3c8423c6aa790c35cbf Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 14 Jun 2021 17:21:55 -0300 Subject: Use `winit` and `glutin` forks in `iced-rs` org --- glutin/Cargo.toml | 6 ++++-- glutin/src/application.rs | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'glutin') diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml index 92aa5018..913ff5b8 100644 --- a/glutin/Cargo.toml +++ b/glutin/Cargo.toml @@ -13,8 +13,10 @@ categories = ["gui"] [features] debug = ["iced_winit/debug"] -[dependencies] -glutin = "0.27" +[dependencies.glutin] +version = "0.27" +git = "https://github.com/iced-rs/glutin" +rev = "be6793b5b3defc9452cd1c896cd315ed7442d546" [dependencies.iced_native] version = "0.4" diff --git a/glutin/src/application.rs b/glutin/src/application.rs index 22dff149..a8e5dbf9 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -237,9 +237,15 @@ async fn run_instance( context.window().request_redraw(); } - event::Event::PlatformSpecific(event::PlatformSpecific::MacOS(event::MacOS::ReceivedUrl(url))) => { + event::Event::PlatformSpecific(event::PlatformSpecific::MacOS( + event::MacOS::ReceivedUrl(url), + )) => { use iced_native::event; - events.push(iced_native::Event::PlatformSpecific(event::PlatformSpecific::MacOS(event::MacOS::ReceivedUrl(url)))); + events.push(iced_native::Event::PlatformSpecific( + event::PlatformSpecific::MacOS(event::MacOS::ReceivedUrl( + url, + )), + )); } event::Event::UserEvent(message) => { messages.push(message); -- cgit From 4994d34abab3222f9a8fd7a9a3e63f969ca97ffc Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 30 Jun 2021 23:44:51 +0200 Subject: Update `winit` and `glutin` to latest `master` --- glutin/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'glutin') diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml index 913ff5b8..78d5fe47 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 = "be6793b5b3defc9452cd1c896cd315ed7442d546" +rev = "2564d0ab87cf2ad824a2a58733aebe40dd2f29bb" [dependencies.iced_native] version = "0.4" -- cgit From 9fc5ad23edca93553137100d167de7b69e88f785 Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 5 Jul 2021 16:23:44 -0300 Subject: Initial menu implementation --- glutin/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'glutin') diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml index 78d5fe47..b42a6b36 100644 --- a/glutin/Cargo.toml +++ b/glutin/Cargo.toml @@ -15,8 +15,8 @@ debug = ["iced_winit/debug"] [dependencies.glutin] version = "0.27" -git = "https://github.com/iced-rs/glutin" -rev = "2564d0ab87cf2ad824a2a58733aebe40dd2f29bb" +# git = "https://github.com/iced-rs/glutin" +# rev = "2564d0ab87cf2ad824a2a58733aebe40dd2f29bb" [dependencies.iced_native] version = "0.4" -- cgit From 31997d255f263a0f47f5af0d8560f3d5bd37f077 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 12 Jul 2021 22:28:18 +0200 Subject: Store and synchronize `Menu` in `application::State` --- glutin/src/application.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'glutin') diff --git a/glutin/src/application.rs b/glutin/src/application.rs index a8e5dbf9..279b6c77 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) -- cgit From 6221adf2b1b1e8150931d4175e1e36870d45f6e5 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 13 Jul 2021 20:55:21 +0200 Subject: Draft `conversion::menu_message` in `iced_winit` ... and wire it up to the runtime loop --- glutin/src/application.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'glutin') diff --git a/glutin/src/application.rs b/glutin/src/application.rs index 279b6c77..991c8705 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -306,6 +306,16 @@ async fn run_instance( // TODO: Handle animations! // 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, .. -- cgit From 82db3c78b6cfa2cc55ece6ffa46811bfb5195f60 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 20 Jul 2021 21:34:20 +0700 Subject: Update `winit` and `glutin` dependencies ... and remove crates.io patch --- glutin/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'glutin') diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml index b42a6b36..b2a7f307 100644 --- a/glutin/Cargo.toml +++ b/glutin/Cargo.toml @@ -15,8 +15,8 @@ debug = ["iced_winit/debug"] [dependencies.glutin] version = "0.27" -# git = "https://github.com/iced-rs/glutin" -# rev = "2564d0ab87cf2ad824a2a58733aebe40dd2f29bb" +git = "https://github.com/iced-rs/glutin" +rev = "03437d8a1826d83c62017b2bb7bf18bfc9e352cc" [dependencies.iced_native] version = "0.4" -- cgit