From b2a9a1e73cb7b2026b2eeaa2be2c04a61c5efb21 Mon Sep 17 00:00:00 2001 From: Bingus Date: Thu, 2 Mar 2023 08:31:39 -0800 Subject: Fixed fullscreen only being possible on primary monitor. --- winit/src/application.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winit/src/application.rs b/winit/src/application.rs index 9781a453..b13b7214 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -762,7 +762,7 @@ pub fn run_command( window::Action::ChangeMode(mode) => { window.set_visible(conversion::visible(mode)); window.set_fullscreen(conversion::fullscreen( - window.primary_monitor(), + window.current_monitor(), mode, )); } -- cgit From a9ca89ca55157d7e94dc6422b4842826139ca2db Mon Sep 17 00:00:00 2001 From: Bingus Date: Thu, 2 Mar 2023 08:43:58 -0800 Subject: Added example of toggling fullscreen to TODOs. --- examples/todos/src/main.rs | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index 6408f09c..0f5bfe30 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::{ @@ -8,6 +8,8 @@ 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}; @@ -49,7 +51,11 @@ enum Message { CreateTask, FilterChanged(Filter), TaskMessage(usize, TaskMessage), - TabPressed { shift: bool }, + TabPressed { + shift: bool, + }, + #[cfg(not(target_arch = "wasm32"))] + ToggleFullscreen(Mode), } impl Application for Todos { @@ -156,6 +162,10 @@ impl Application for Todos { widget::focus_next() } } + #[cfg(not(target_arch = "wasm32"))] + Message::ToggleFullscreen(mode) => { + window::change_mode(mode) + } _ => Command::none(), }; @@ -266,6 +276,22 @@ impl Application for Todos { ) => Some(Message::TabPressed { shift: modifiers.shift(), }), + #[cfg(not(target_arch = "wasm32"))] + ( + Event::Keyboard(keyboard::Event::KeyPressed { + key_code, + modifiers: Modifiers::SHIFT, + }), + event::Status::Ignored, + ) => match key_code { + KeyCode::Up => { + Some(Message::ToggleFullscreen(Mode::Fullscreen)) + } + KeyCode::Down => { + Some(Message::ToggleFullscreen(Mode::Windowed)) + } + _ => None, + }, _ => None, }) } -- cgit From 12781c717a08bf0e7bfb2594e568f89af3676d52 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 3 Mar 2023 20:45:49 +0100 Subject: Expose `window` commands for Wasm builds --- examples/todos/src/main.rs | 15 ++++----------- src/window.rs | 1 - 2 files changed, 4 insertions(+), 12 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, }, diff --git a/src/window.rs b/src/window.rs index 2018053f..5a199580 100644 --- a/src/window.rs +++ b/src/window.rs @@ -8,5 +8,4 @@ pub use icon::Icon; pub use position::Position; pub use settings::Settings; -#[cfg(not(target_arch = "wasm32"))] pub use crate::runtime::window::*; -- cgit From df68cca0c9dda051ae979ccc2f5ca8d37c3e3cb5 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 7 Mar 2023 07:22:48 +0100 Subject: Update `sysinfo` to `0.28` --- winit/Cargo.toml | 2 +- winit/src/system.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/winit/Cargo.toml b/winit/Cargo.toml index 60e464c6..dd5c12c2 100644 --- a/winit/Cargo.toml +++ b/winit/Cargo.toml @@ -65,5 +65,5 @@ version = "0.3" features = ["Document", "Window"] [dependencies.sysinfo] -version = "0.23" +version = "0.28" optional = true 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( 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")) -- cgit From 782c080bd098dd56e74a3c8adabf09bf5dae047b Mon Sep 17 00:00:00 2001 From: lupd <93457935+lupd@users.noreply.github.com> Date: Wed, 8 Mar 2023 12:55:52 -0500 Subject: Use correct package name in checkbox example docs --- examples/checkbox/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit