diff options
author | 2024-01-12 22:57:52 -0800 | |
---|---|---|
committer | 2024-02-13 04:45:07 +0100 | |
commit | f93a6d740ac4cb09720bcb502b04e9a3d993bdba (patch) | |
tree | 5432c487cd412bcac1c96b228ae167b040132047 /runtime/src/window.rs | |
parent | 7a1e10503697b68a4d6206551c34702ec8a69b79 (diff) | |
download | iced-f93a6d740ac4cb09720bcb502b04e9a3d993bdba.tar.gz iced-f93a6d740ac4cb09720bcb502b04e9a3d993bdba.tar.bz2 iced-f93a6d740ac4cb09720bcb502b04e9a3d993bdba.zip |
Add `show_window_menu` action
Winit currently supports this only on Windows and Wayland.
This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.
Diffstat (limited to 'runtime/src/window.rs')
-rw-r--r-- | runtime/src/window.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 4d97d5ee..44b707b2 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -160,6 +160,11 @@ pub fn change_level<Message>(id: Id, level: Level) -> Command<Message> { Command::single(command::Action::Window(Action::ChangeLevel(id, level))) } +/// Show window menu at cursor position. +pub fn show_window_menu<Message>(id: Id) -> Command<Message> { + Command::single(command::Action::Window(Action::ShowWindowMenu(id))) +} + /// Fetches an identifier unique to the window, provided by the underlying windowing system. This is /// not to be confused with [`Id`]. pub fn fetch_id<Message>( |