Expose window commands for Wasm builds
This commit is contained in:
parent
a9ca89ca55
commit
12781c717a
2 changed files with 4 additions and 12 deletions
|
|
@ -8,8 +8,6 @@ use iced::widget::{
|
||||||
text_input, Text,
|
text_input, Text,
|
||||||
};
|
};
|
||||||
use iced::window;
|
use iced::window;
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
use iced::window::Mode;
|
|
||||||
use iced::{Application, Element};
|
use iced::{Application, Element};
|
||||||
use iced::{Color, Command, Font, Length, Settings, Subscription};
|
use iced::{Color, Command, Font, Length, Settings, Subscription};
|
||||||
|
|
||||||
|
|
@ -51,11 +49,8 @@ enum Message {
|
||||||
CreateTask,
|
CreateTask,
|
||||||
FilterChanged(Filter),
|
FilterChanged(Filter),
|
||||||
TaskMessage(usize, TaskMessage),
|
TaskMessage(usize, TaskMessage),
|
||||||
TabPressed {
|
TabPressed { shift: bool },
|
||||||
shift: bool,
|
ToggleFullscreen(window::Mode),
|
||||||
},
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
ToggleFullscreen(Mode),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Application for Todos {
|
impl Application for Todos {
|
||||||
|
|
@ -162,7 +157,6 @@ impl Application for Todos {
|
||||||
widget::focus_next()
|
widget::focus_next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
Message::ToggleFullscreen(mode) => {
|
Message::ToggleFullscreen(mode) => {
|
||||||
window::change_mode(mode)
|
window::change_mode(mode)
|
||||||
}
|
}
|
||||||
|
|
@ -276,7 +270,6 @@ impl Application for Todos {
|
||||||
) => Some(Message::TabPressed {
|
) => Some(Message::TabPressed {
|
||||||
shift: modifiers.shift(),
|
shift: modifiers.shift(),
|
||||||
}),
|
}),
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
(
|
(
|
||||||
Event::Keyboard(keyboard::Event::KeyPressed {
|
Event::Keyboard(keyboard::Event::KeyPressed {
|
||||||
key_code,
|
key_code,
|
||||||
|
|
@ -285,10 +278,10 @@ impl Application for Todos {
|
||||||
event::Status::Ignored,
|
event::Status::Ignored,
|
||||||
) => match key_code {
|
) => match key_code {
|
||||||
KeyCode::Up => {
|
KeyCode::Up => {
|
||||||
Some(Message::ToggleFullscreen(Mode::Fullscreen))
|
Some(Message::ToggleFullscreen(window::Mode::Fullscreen))
|
||||||
}
|
}
|
||||||
KeyCode::Down => {
|
KeyCode::Down => {
|
||||||
Some(Message::ToggleFullscreen(Mode::Windowed))
|
Some(Message::ToggleFullscreen(window::Mode::Windowed))
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,4 @@ pub use icon::Icon;
|
||||||
pub use position::Position;
|
pub use position::Position;
|
||||||
pub use settings::Settings;
|
pub use settings::Settings;
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
pub use crate::runtime::window::*;
|
pub use crate::runtime::window::*;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue