From 68c760e65203c5124844c2083224d8c83010ed1e Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 9 Jan 2024 11:45:00 -0700 Subject: [PATCH] Allow apps to return a command when context drawer is toggled --- src/app/cosmic.rs | 1 + src/app/mod.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/app/cosmic.rs b/src/app/cosmic.rs index 4da3654e..e06840ca 100644 --- a/src/app/cosmic.rs +++ b/src/app/cosmic.rs @@ -332,6 +332,7 @@ impl Cosmic { Message::ContextDrawer(show) => { self.app.core_mut().window.show_context = show; + return self.app.on_context_drawer(); } Message::Drag => return command::drag(None), diff --git a/src/app/mod.rs b/src/app/mod.rs index 5877d451..0de53d9d 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -440,6 +440,11 @@ where None } + // Called when context drawer is toggled + fn on_context_drawer(&mut self) -> iced::Command> { + iced::Command::none() + } + /// Called when the escape key is pressed. fn on_escape(&mut self) -> iced::Command> { iced::Command::none()