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)]
|
#![deny(unused_results)]
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
#![forbid(rust_2018_idioms)]
|
#![forbid(rust_2018_idioms)]
|
||||||
|
pub mod keyboard;
|
||||||
|
|
||||||
mod align;
|
mod align;
|
||||||
mod background;
|
mod background;
|
||||||
|
@ -7,4 +7,3 @@ publish = false
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
iced = { path = "../.." }
|
iced = { path = "../.." }
|
||||||
iced_native = { path = "../../native" }
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use iced::{
|
use iced::{
|
||||||
button, pane_grid, scrollable, Align, Button, Column, Container, Element,
|
button, keyboard, pane_grid, scrollable, Align, Button, Column, Container,
|
||||||
HorizontalAlignment, Length, PaneGrid, Sandbox, Scrollable, Settings, Text,
|
Element, HorizontalAlignment, Length, PaneGrid, Sandbox, Scrollable,
|
||||||
|
Settings, Text,
|
||||||
};
|
};
|
||||||
use iced_native::input::keyboard;
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
Example::run(Settings::default())
|
Example::run(Settings::default())
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
//! Build keyboard events.
|
//! Build keyboard events.
|
||||||
mod event;
|
mod event;
|
||||||
mod key_code;
|
|
||||||
mod modifiers_state;
|
|
||||||
|
|
||||||
pub use event::Event;
|
pub use event::Event;
|
||||||
pub use key_code::KeyCode;
|
pub use iced_core::keyboard::{KeyCode, ModifiersState};
|
||||||
pub use modifiers_state::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;
|
mod sandbox;
|
||||||
|
|
||||||
pub mod executor;
|
pub mod executor;
|
||||||
|
pub mod keyboard;
|
||||||
pub mod settings;
|
pub mod settings;
|
||||||
pub mod widget;
|
pub mod widget;
|
||||||
pub mod window;
|
pub mod window;
|
||||||
|
@ -73,8 +73,8 @@ pub use dodrio;
|
|||||||
pub use element::Element;
|
pub use element::Element;
|
||||||
pub use hasher::Hasher;
|
pub use hasher::Hasher;
|
||||||
pub use iced_core::{
|
pub use iced_core::{
|
||||||
Align, Background, Color, Font, HorizontalAlignment, Length, Point, Size,
|
keyboard, Align, Background, Color, Font, HorizontalAlignment, Length,
|
||||||
Vector, VerticalAlignment,
|
Point, Size, Vector, VerticalAlignment,
|
||||||
};
|
};
|
||||||
pub use iced_futures::{executor, futures, Command};
|
pub use iced_futures::{executor, futures, Command};
|
||||||
pub use subscription::Subscription;
|
pub use subscription::Subscription;
|
||||||
|
Loading…
Reference in New Issue
Block a user