diff options
| author | 2023-03-09 19:05:38 +0100 | |
|---|---|---|
| committer | 2023-03-09 19:05:38 +0100 | |
| commit | caf2836b1b15bff6e8a2ea72441d67f297eb8707 (patch) | |
| tree | 0ffa0d1d604780999892b88de85ee93e3ed7d539 /examples/todos | |
| parent | 11b2c3bbe31a43e73a61b9bd9f022233f302ae27 (diff) | |
| parent | 424ac8177309440bbd8efe0dd9f7622cb10807ce (diff) | |
| download | iced-caf2836b1b15bff6e8a2ea72441d67f297eb8707.tar.gz iced-caf2836b1b15bff6e8a2ea72441d67f297eb8707.tar.bz2 iced-caf2836b1b15bff6e8a2ea72441d67f297eb8707.zip  | |
Merge pull request #1748 from iced-rs/feature/software-renderer
Software renderer, runtime renderer fallback, and core consolidation
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 5df4e968..1cc18eca 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -1,7 +1,7 @@  use iced::alignment::{self, Alignment};  use iced::event::{self, Event};  use iced::font::{self, Font}; -use iced::keyboard; +use iced::keyboard::{self, KeyCode, Modifiers};  use iced::subscription;  use iced::theme::{self, Theme};  use iced::widget::{ @@ -52,6 +52,7 @@ enum Message {      FilterChanged(Filter),      TaskMessage(usize, TaskMessage),      TabPressed { shift: bool }, +    ToggleFullscreen(window::Mode),  }  impl Application for Todos { @@ -162,6 +163,9 @@ impl Application for Todos {                              widget::focus_next()                          }                      } +                    Message::ToggleFullscreen(mode) => { +                        window::change_mode(mode) +                    }                      _ => Command::none(),                  }; @@ -272,6 +276,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,          })      }  | 
