diff options
author | 2023-03-03 20:45:49 +0100 | |
---|---|---|
committer | 2023-03-03 20:45:49 +0100 | |
commit | 12781c717a08bf0e7bfb2594e568f89af3676d52 (patch) | |
tree | c1ade16c311b0d27e2015327138d8883c052c8f2 /examples/todos | |
parent | a9ca89ca55157d7e94dc6422b4842826139ca2db (diff) | |
download | iced-12781c717a08bf0e7bfb2594e568f89af3676d52.tar.gz iced-12781c717a08bf0e7bfb2594e568f89af3676d52.tar.bz2 iced-12781c717a08bf0e7bfb2594e568f89af3676d52.zip |
Expose `window` commands for Wasm builds
Diffstat (limited to 'examples/todos')
-rw-r--r-- | examples/todos/src/main.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index 0f5bfe30..6a87f58c 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -8,8 +8,6 @@ use iced::widget::{ text_input, Text, }; use iced::window; -#[cfg(not(target_arch = "wasm32"))] -use iced::window::Mode; use iced::{Application, Element}; use iced::{Color, Command, Font, Length, Settings, Subscription}; @@ -51,11 +49,8 @@ enum Message { CreateTask, FilterChanged(Filter), TaskMessage(usize, TaskMessage), - TabPressed { - shift: bool, - }, - #[cfg(not(target_arch = "wasm32"))] - ToggleFullscreen(Mode), + TabPressed { shift: bool }, + ToggleFullscreen(window::Mode), } impl Application for Todos { @@ -162,7 +157,6 @@ impl Application for Todos { widget::focus_next() } } - #[cfg(not(target_arch = "wasm32"))] Message::ToggleFullscreen(mode) => { window::change_mode(mode) } @@ -276,7 +270,6 @@ impl Application for Todos { ) => Some(Message::TabPressed { shift: modifiers.shift(), }), - #[cfg(not(target_arch = "wasm32"))] ( Event::Keyboard(keyboard::Event::KeyPressed { key_code, @@ -285,10 +278,10 @@ impl Application for Todos { event::Status::Ignored, ) => match key_code { KeyCode::Up => { - Some(Message::ToggleFullscreen(Mode::Fullscreen)) + Some(Message::ToggleFullscreen(window::Mode::Fullscreen)) } KeyCode::Down => { - Some(Message::ToggleFullscreen(Mode::Windowed)) + Some(Message::ToggleFullscreen(window::Mode::Windowed)) } _ => None, }, |