From f93a6d740ac4cb09720bcb502b04e9a3d993bdba Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 12 Jan 2024 22:57:52 -0800 Subject: 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. --- runtime/src/window.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime/src/window.rs') 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(id: Id, level: Level) -> Command { Command::single(command::Action::Window(Action::ChangeLevel(id, level))) } +/// Show window menu at cursor position. +pub fn show_window_menu(id: Id) -> Command { + 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( -- cgit From f1c5186e79cdcc8730df7e557ef8480a10a8330d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 13 Feb 2024 04:49:27 +0100 Subject: Rename `show_window_menu` to `show_system_menu` --- runtime/src/window.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'runtime/src/window.rs') diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 44b707b2..04bcfcd8 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -160,9 +160,11 @@ pub fn change_level(id: Id, level: Level) -> Command { Command::single(command::Action::Window(Action::ChangeLevel(id, level))) } -/// Show window menu at cursor position. -pub fn show_window_menu(id: Id) -> Command { - Command::single(command::Action::Window(Action::ShowWindowMenu(id))) +/// Show the [system menu] at cursor position. +/// +/// [system menu]: https://en.wikipedia.org/wiki/Common_menus_in_Microsoft_Windows#System_menu +pub fn show_system_menu(id: Id) -> Command { + Command::single(command::Action::Window(Action::ShowSystemMenu(id))) } /// Fetches an identifier unique to the window, provided by the underlying windowing system. This is -- cgit