Move common keyboard types to iced_core
Also expose them in `iced` through `iced_native` and `iced_web`.
This commit is contained in:
parent
1cd1582506
commit
05beb87852
6
core/src/keyboard.rs
Normal file
6
core/src/keyboard.rs
Normal file
@ -0,0 +1,6 @@
|
||||
//! Reuse basic keyboard types.
|
||||
mod key_code;
|
||||
mod modifiers_state;
|
||||
|
||||
pub use key_code::KeyCode;
|
||||
pub use modifiers_state::ModifiersState;
|
@ -14,6 +14,7 @@
|
||||
#![deny(unused_results)]
|
||||
#![forbid(unsafe_code)]
|
||||
#![forbid(rust_2018_idioms)]
|
||||
pub mod keyboard;
|
||||
|
||||
mod align;
|
||||
mod background;
|
||||
|
@ -7,4 +7,3 @@ publish = false
|
||||
|
||||
[dependencies]
|
||||
iced = { path = "../.." }
|
||||
iced_native = { path = "../../native" }
|
||||
|
@ -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())
|
||||
|
@ -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};
|
||||
|
6
src/keyboard.rs
Normal file
6
src/keyboard.rs
Normal file
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user