diff options
author | 2023-03-03 21:20:11 +0100 | |
---|---|---|
committer | 2023-03-03 21:20:11 +0100 | |
commit | d73ca4de0f1f2c0f64bce78be819516dcaac8ed2 (patch) | |
tree | c1ade16c311b0d27e2015327138d8883c052c8f2 /examples/todos | |
parent | 86b85d1436a44e82a9765f9d82b026faf26e22de (diff) | |
parent | 12781c717a08bf0e7bfb2594e568f89af3676d52 (diff) | |
download | iced-d73ca4de0f1f2c0f64bce78be819516dcaac8ed2.tar.gz iced-d73ca4de0f1f2c0f64bce78be819516dcaac8ed2.tar.bz2 iced-d73ca4de0f1f2c0f64bce78be819516dcaac8ed2.zip |
Merge pull request #1742 from bungoboingo/fix/fullscreen
[Fix] Fullscreen only works on primary monitor
Diffstat (limited to 'examples/todos')
-rw-r--r-- | examples/todos/src/main.rs | 21 |
1 files changed, 20 insertions, 1 deletions
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, }) } |