summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/keyboard.rs6
-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.rs1
-rw-r--r--examples/pane_grid/Cargo.toml1
-rw-r--r--examples/pane_grid/src/main.rs6
-rw-r--r--native/src/input/keyboard.rs5
-rw-r--r--src/keyboard.rs6
-rw-r--r--src/lib.rs1
-rw-r--r--web/src/lib.rs4
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};
diff --git a/src/lib.rs b/src/lib.rs
index d492db02..aeec24c2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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;