Merge remote-tracking branch 'origin/master' into feat/multi-window-support
This commit is contained in:
commit
fa068b904a
6 changed files with 25 additions and 7 deletions
|
|
@ -6,7 +6,7 @@ The __[`main`]__ file contains all the code of the example.
|
|||
|
||||
You can run it with `cargo run`:
|
||||
```
|
||||
cargo run --package pick_list
|
||||
cargo run --package checkbox
|
||||
```
|
||||
|
||||
[`main`]: src/main.rs
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use iced::alignment::{self, Alignment};
|
||||
use iced::event::{self, Event};
|
||||
use iced::keyboard;
|
||||
use iced::keyboard::{self, KeyCode, Modifiers};
|
||||
use iced::subscription;
|
||||
use iced::theme::{self, Theme};
|
||||
use iced::widget::{
|
||||
|
|
@ -50,6 +50,7 @@ enum Message {
|
|||
FilterChanged(Filter),
|
||||
TaskMessage(usize, TaskMessage),
|
||||
TabPressed { shift: bool },
|
||||
ToggleFullscreen(window::Mode),
|
||||
}
|
||||
|
||||
impl Application for Todos {
|
||||
|
|
@ -156,6 +157,9 @@ impl Application for Todos {
|
|||
widget::focus_next()
|
||||
}
|
||||
}
|
||||
Message::ToggleFullscreen(mode) => {
|
||||
window::change_mode(mode)
|
||||
}
|
||||
_ => Command::none(),
|
||||
};
|
||||
|
||||
|
|
@ -266,6 +270,21 @@ impl Application for Todos {
|
|||
) => Some(Message::TabPressed {
|
||||
shift: modifiers.shift(),
|
||||
}),
|
||||
(
|
||||
Event::Keyboard(keyboard::Event::KeyPressed {
|
||||
key_code,
|
||||
modifiers: Modifiers::SHIFT,
|
||||
}),
|
||||
event::Status::Ignored,
|
||||
) => match key_code {
|
||||
KeyCode::Up => {
|
||||
Some(Message::ToggleFullscreen(window::Mode::Fullscreen))
|
||||
}
|
||||
KeyCode::Down => {
|
||||
Some(Message::ToggleFullscreen(window::Mode::Windowed))
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,5 +3,4 @@ pub use iced_native::window::Icon;
|
|||
pub use iced_native::window::Position;
|
||||
pub use iced_native::window::Settings;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub use crate::runtime::window::*;
|
||||
|
|
|
|||
|
|
@ -66,5 +66,5 @@ version = "0.3"
|
|||
features = ["Document", "Window"]
|
||||
|
||||
[dependencies.sysinfo]
|
||||
version = "0.23"
|
||||
version = "0.28"
|
||||
optional = true
|
||||
|
|
|
|||
|
|
@ -767,7 +767,7 @@ pub fn run_command<A, E>(
|
|||
window::Action::ChangeMode(mode) => {
|
||||
window.set_visible(conversion::visible(mode));
|
||||
window.set_fullscreen(conversion::fullscreen(
|
||||
window.primary_monitor(),
|
||||
window.current_monitor(),
|
||||
mode,
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ pub fn fetch_information<Message>(
|
|||
pub(crate) fn information(
|
||||
graphics_info: compositor::Information,
|
||||
) -> Information {
|
||||
use sysinfo::{ProcessExt, ProcessorExt, System, SystemExt};
|
||||
use sysinfo::{CpuExt, ProcessExt, System, SystemExt};
|
||||
let mut system = System::new_all();
|
||||
system.refresh_all();
|
||||
|
||||
let cpu = system.global_processor_info();
|
||||
let cpu = system.global_cpu_info();
|
||||
|
||||
let memory_used = sysinfo::get_current_pid()
|
||||
.and_then(|pid| system.process(pid).ok_or("Process not found"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue