From 56dbd683269b82da16d8eae3f98f352301750bf5 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 28 Apr 2020 03:11:01 +0200 Subject: Move reusable `mouse` types to `iced_core` --- src/lib.rs | 4 ++++ src/mouse.rs | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 src/mouse.rs (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 4f66cc73..77044984 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -185,6 +185,7 @@ mod sandbox; pub mod executor; pub mod keyboard; +pub mod mouse; pub mod settings; pub mod widget; pub mod window; @@ -208,3 +209,6 @@ pub use runtime::{ futures, Align, Background, Color, Command, Font, HorizontalAlignment, Length, Point, Size, Subscription, Vector, VerticalAlignment, }; + +#[cfg(not(target_arch = "wasm32"))] +pub use runtime::input::ButtonState; diff --git a/src/mouse.rs b/src/mouse.rs new file mode 100644 index 00000000..8be36d37 --- /dev/null +++ b/src/mouse.rs @@ -0,0 +1,3 @@ +//! Listen and react to mouse events. +#[cfg(not(target_arch = "wasm32"))] +pub use iced_winit::input::mouse::{Button, Event, ScrollDelta}; -- cgit From 2539042b71d70afd4d8f262783d441e768811ee9 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 28 Apr 2020 06:24:12 +0200 Subject: Remove `Drawable` and rename `State` to `Program` --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 77044984..eee7a6ee 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -207,7 +207,7 @@ use iced_web as runtime; pub use runtime::{ futures, Align, Background, Color, Command, Font, HorizontalAlignment, - Length, Point, Size, Subscription, Vector, VerticalAlignment, + Length, Point, Rectangle, Size, Subscription, Vector, VerticalAlignment, }; #[cfg(not(target_arch = "wasm32"))] -- cgit From ec712c8032a25c5dc65152c3ab39bddaecbdce77 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 29 Apr 2020 03:21:46 +0200 Subject: Move `MouseCursor` to `iced_core` --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index eee7a6ee..c574a345 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -207,7 +207,8 @@ use iced_web as runtime; pub use runtime::{ futures, Align, Background, Color, Command, Font, HorizontalAlignment, - Length, Point, Rectangle, Size, Subscription, Vector, VerticalAlignment, + Length, MouseCursor, Point, Rectangle, Size, Subscription, Vector, + VerticalAlignment, }; #[cfg(not(target_arch = "wasm32"))] -- cgit From d8b9e03481301228ffeda4c6e48a021cb66f896c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 30 Apr 2020 04:54:49 +0200 Subject: Remove `ButtonState` --- src/lib.rs | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index c574a345..e03cd7e9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -210,6 +210,3 @@ pub use runtime::{ Length, MouseCursor, Point, Rectangle, Size, Subscription, Vector, VerticalAlignment, }; - -#[cfg(not(target_arch = "wasm32"))] -pub use runtime::input::ButtonState; -- cgit From bb9ccc4f62ceea08dc1ef0c6c4d3d219897e44a1 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 30 Apr 2020 05:04:45 +0200 Subject: Remove inconsistent `input` module in `iced_native` --- src/keyboard.rs | 6 +----- src/mouse.rs | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/keyboard.rs b/src/keyboard.rs index 181dd974..0b3e894d 100644 --- a/src/keyboard.rs +++ b/src/keyboard.rs @@ -1,6 +1,2 @@ //! Listen and react to keyboard events. -#[cfg(not(target_arch = "wasm32"))] -pub use iced_winit::input::keyboard::{KeyCode, ModifiersState}; - -#[cfg(target_arch = "wasm32")] -pub use iced_web::keyboard::{KeyCode, ModifiersState}; +pub use crate::runtime::keyboard::{Event, KeyCode, ModifiersState}; diff --git a/src/mouse.rs b/src/mouse.rs index 8be36d37..c511399b 100644 --- a/src/mouse.rs +++ b/src/mouse.rs @@ -1,3 +1,2 @@ //! Listen and react to mouse events. -#[cfg(not(target_arch = "wasm32"))] -pub use iced_winit::input::mouse::{Button, Event, ScrollDelta}; +pub use crate::runtime::mouse::{Button, Event, ScrollDelta}; -- cgit From e2076612cb98d04a8a48add14d0068c2974d5653 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 30 Apr 2020 05:37:44 +0200 Subject: Implement `time::every` in `iced_futures` --- src/lib.rs | 4 ++++ src/time.rs | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/time.rs (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index e03cd7e9..d1e5fb94 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -190,6 +190,10 @@ pub mod settings; pub mod widget; pub mod window; +#[cfg(any(feature = "tokio", feature = "async-std"))] +#[cfg_attr(docsrs, doc(cfg(any(feature = "tokio", feature = "async-std"))))] +pub mod time; + #[doc(no_inline)] pub use widget::*; diff --git a/src/time.rs b/src/time.rs new file mode 100644 index 00000000..cd442461 --- /dev/null +++ b/src/time.rs @@ -0,0 +1,14 @@ +//! Listen and react to time. +use crate::Subscription; + +/// Returns a [`Subscription`] that produces messages at a set interval. +/// +/// The first message is produced after a `duration`, and then continues to +/// produce more messages every `duration` after that. +/// +/// [`Subscription`]: ../subscription/struct.Subscription.html +pub fn every( + duration: std::time::Duration, +) -> Subscription { + iced_futures::time::every(duration) +} -- cgit From 1501a93915b3704a1d57da4c390a8ebca4e35c8b Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 30 Apr 2020 05:51:41 +0200 Subject: Disable `time` module on Wasm for now --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index d1e5fb94..7885ee12 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -190,7 +190,10 @@ pub mod settings; pub mod widget; pub mod window; -#[cfg(any(feature = "tokio", feature = "async-std"))] +#[cfg(all( + any(feature = "tokio", feature = "async-std"), + not(target_arch = "wasm32") +))] #[cfg_attr(docsrs, doc(cfg(any(feature = "tokio", feature = "async-std"))))] pub mod time; -- cgit From 98bc8cf2a7c4944d762a0148ca9f615d6ccc0d6e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 30 Apr 2020 08:16:38 +0200 Subject: Rename `MouseCursor` to `mouse::Interaction` --- src/lib.rs | 3 +-- src/mouse.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 7885ee12..2c08268b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -214,6 +214,5 @@ use iced_web as runtime; pub use runtime::{ futures, Align, Background, Color, Command, Font, HorizontalAlignment, - Length, MouseCursor, Point, Rectangle, Size, Subscription, Vector, - VerticalAlignment, + Length, Point, Rectangle, Size, Subscription, Vector, VerticalAlignment, }; diff --git a/src/mouse.rs b/src/mouse.rs index c511399b..d61ed09a 100644 --- a/src/mouse.rs +++ b/src/mouse.rs @@ -1,2 +1,2 @@ //! Listen and react to mouse events. -pub use crate::runtime::mouse::{Button, Event, ScrollDelta}; +pub use crate::runtime::mouse::{Button, Event, Interaction, ScrollDelta}; -- cgit