diff options
author | 2020-03-17 07:28:28 +0100 | |
---|---|---|
committer | 2020-03-17 07:30:05 +0100 | |
commit | 05beb878527b4d4e3141ca5ba09337d6ada858be (patch) | |
tree | d95ab2be4be002618eb054c61007b2ab661cd164 | |
parent | 1cd1582506810255394d2f9019597e9252bd8daa (diff) | |
download | iced-05beb878527b4d4e3141ca5ba09337d6ada858be.tar.gz iced-05beb878527b4d4e3141ca5ba09337d6ada858be.tar.bz2 iced-05beb878527b4d4e3141ca5ba09337d6ada858be.zip |
Move common keyboard types to `iced_core`
Also expose them in `iced` through `iced_native` and `iced_web`.
-rw-r--r-- | core/src/keyboard.rs | 6 | ||||
-rw-r--r-- | core/src/keyboard/key_code.rs (renamed from native/src/input/keyboard/key_code.rs) | 0 | ||||
-rw-r--r-- | core/src/keyboard/modifiers_state.rs (renamed from native/src/input/keyboard/modifiers_state.rs) | 0 | ||||
-rw-r--r-- | core/src/lib.rs | 1 | ||||
-rw-r--r-- | examples/pane_grid/Cargo.toml | 1 | ||||
-rw-r--r-- | examples/pane_grid/src/main.rs | 6 | ||||
-rw-r--r-- | native/src/input/keyboard.rs | 5 | ||||
-rw-r--r-- | src/keyboard.rs | 6 | ||||
-rw-r--r-- | src/lib.rs | 1 | ||||
-rw-r--r-- | web/src/lib.rs | 4 |
10 files changed, 20 insertions, 10 deletions
diff --git a/core/src/keyboard.rs b/core/src/keyboard.rs new file mode 100644 index 00000000..d98b2989 --- /dev/null +++ b/core/src/keyboard.rs @@ -0,0 +1,6 @@ +//! Reuse basic keyboard types. +mod key_code; +mod modifiers_state; + +pub use key_code::KeyCode; +pub use modifiers_state::ModifiersState; diff --git a/native/src/input/keyboard/key_code.rs b/core/src/keyboard/key_code.rs index 26020a57..26020a57 100644 --- a/native/src/input/keyboard/key_code.rs +++ b/core/src/keyboard/key_code.rs diff --git a/native/src/input/keyboard/modifiers_state.rs b/core/src/keyboard/modifiers_state.rs index 3058c065..3058c065 100644 --- a/native/src/input/keyboard/modifiers_state.rs +++ b/core/src/keyboard/modifiers_state.rs diff --git a/core/src/lib.rs b/core/src/lib.rs index ea5e8b43..c2887a0b 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -14,6 +14,7 @@ #![deny(unused_results)] #![forbid(unsafe_code)] #![forbid(rust_2018_idioms)] +pub mod keyboard; mod align; mod background; diff --git a/examples/pane_grid/Cargo.toml b/examples/pane_grid/Cargo.toml index fb160a8d..3ed912ac 100644 --- a/examples/pane_grid/Cargo.toml +++ b/examples/pane_grid/Cargo.toml @@ -7,4 +7,3 @@ publish = false [dependencies] iced = { path = "../.." } -iced_native = { path = "../../native" } diff --git a/examples/pane_grid/src/main.rs b/examples/pane_grid/src/main.rs index 461ffc30..9e6283ab 100644 --- a/examples/pane_grid/src/main.rs +++ b/examples/pane_grid/src/main.rs @@ -1,8 +1,8 @@ use iced::{ - button, pane_grid, scrollable, Align, Button, Column, Container, Element, - HorizontalAlignment, Length, PaneGrid, Sandbox, Scrollable, Settings, Text, + button, keyboard, pane_grid, scrollable, Align, Button, Column, Container, + Element, HorizontalAlignment, Length, PaneGrid, Sandbox, Scrollable, + Settings, Text, }; -use iced_native::input::keyboard; pub fn main() { Example::run(Settings::default()) diff --git a/native/src/input/keyboard.rs b/native/src/input/keyboard.rs index 432e75ba..928bf492 100644 --- a/native/src/input/keyboard.rs +++ b/native/src/input/keyboard.rs @@ -1,8 +1,5 @@ //! Build keyboard events. mod event; -mod key_code; -mod modifiers_state; pub use event::Event; -pub use key_code::KeyCode; -pub use modifiers_state::ModifiersState; +pub use iced_core::keyboard::{KeyCode, ModifiersState}; diff --git a/src/keyboard.rs b/src/keyboard.rs new file mode 100644 index 00000000..181dd974 --- /dev/null +++ b/src/keyboard.rs @@ -0,0 +1,6 @@ +//! 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}; @@ -183,6 +183,7 @@ mod element; mod sandbox; pub mod executor; +pub mod keyboard; pub mod settings; pub mod widget; pub mod window; diff --git a/web/src/lib.rs b/web/src/lib.rs index 258ad9e7..1de00545 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -73,8 +73,8 @@ pub use dodrio; pub use element::Element; pub use hasher::Hasher; pub use iced_core::{ - Align, Background, Color, Font, HorizontalAlignment, Length, Point, Size, - Vector, VerticalAlignment, + keyboard, Align, Background, Color, Font, HorizontalAlignment, Length, + Point, Size, Vector, VerticalAlignment, }; pub use iced_futures::{executor, futures, Command}; pub use subscription::Subscription; |