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. --- winit/src/application.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index ad461738..c2bd11e2 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -807,6 +807,14 @@ pub fn run_command( window::Action::ChangeLevel(_id, level) => { window.set_window_level(conversion::window_level(level)); } + window::Action::ShowWindowMenu(_id) => { + if let mouse::Cursor::Available(point) = state.cursor() { + window.show_window_menu(winit::dpi::LogicalPosition { + x: point.x, + y: point.y, + }); + } + } window::Action::FetchId(_id, tag) => { proxy .send_event(tag(window.id().into())) -- cgit