summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Bingus <shankern@protonmail.com>2023-03-13 13:23:45 -0700
committerLibravatar Bingus <shankern@protonmail.com>2023-03-13 13:23:45 -0700
commitfa068b904a904c86195ebfaa4e953466426a27aa (patch)
tree146034f9e333082ec4cf84aa41f9275616f30bb1
parente36daa6f937abd7cb2071fd8852a3c12263944ea (diff)
parent8f14b448d263a2cfd03a998b1d54c21e33d58980 (diff)
downloadiced-fa068b904a904c86195ebfaa4e953466426a27aa.tar.gz
iced-fa068b904a904c86195ebfaa4e953466426a27aa.tar.bz2
iced-fa068b904a904c86195ebfaa4e953466426a27aa.zip
Merge remote-tracking branch 'origin/master' into feat/multi-window-support
-rw-r--r--examples/checkbox/README.md2
-rw-r--r--examples/todos/src/main.rs21
-rw-r--r--src/window.rs1
-rw-r--r--winit/Cargo.toml2
-rw-r--r--winit/src/application.rs2
-rw-r--r--winit/src/system.rs4
6 files changed, 25 insertions, 7 deletions
diff --git a/examples/checkbox/README.md b/examples/checkbox/README.md
index b7f85684..76e6764c 100644
--- a/examples/checkbox/README.md
+++ b/examples/checkbox/README.md
@@ -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
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index 6408f09c..6a87f58c 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/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,
})
}
diff --git a/src/window.rs b/src/window.rs
index 73e90243..c8f5c3ae 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -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::*;
diff --git a/winit/Cargo.toml b/winit/Cargo.toml
index 443d89be..7de69528 100644
--- a/winit/Cargo.toml
+++ b/winit/Cargo.toml
@@ -66,5 +66,5 @@ version = "0.3"
features = ["Document", "Window"]
[dependencies.sysinfo]
-version = "0.23"
+version = "0.28"
optional = true
diff --git a/winit/src/application.rs b/winit/src/application.rs
index 1310ba1c..906da3c6 100644
--- a/winit/src/application.rs
+++ b/winit/src/application.rs
@@ -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,
));
}
diff --git a/winit/src/system.rs b/winit/src/system.rs
index 619086b8..8d8b018c 100644
--- a/winit/src/system.rs
+++ b/winit/src/system.rs
@@ -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"))