Add Window::show_window_menu
Add a method to request a system menu. The implementation is provided only on Windows for now. Co-authored-by: daxpedda <daxpedda@gmail.com> Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
parent
42c9b7e40e
commit
1ea41a2ee2
10 changed files with 154 additions and 19 deletions
|
|
@ -40,7 +40,7 @@ pub use raw_window_handle;
|
|||
/// ```no_run
|
||||
/// use winit::{
|
||||
/// event::{Event, WindowEvent},
|
||||
/// event_loop::EventLoop,
|
||||
/// event_loop::{ControlFlow, EventLoop},
|
||||
/// window::Window,
|
||||
/// };
|
||||
///
|
||||
|
|
@ -1423,6 +1423,21 @@ impl Window {
|
|||
.maybe_wait_on_main(|w| w.drag_resize_window(direction))
|
||||
}
|
||||
|
||||
/// Show [window menu] at a specified position .
|
||||
///
|
||||
/// This is the context menu that is normally shown when interacting with
|
||||
/// the title bar. This is useful when implementing custom decorations.
|
||||
///
|
||||
/// ## Platform-specific
|
||||
/// **Android / iOS / macOS / Orbital / Wayland / Web / X11:** Unsupported.
|
||||
///
|
||||
/// [window menu]: https://en.wikipedia.org/wiki/Common_menus_in_Microsoft_Windows#System_menu
|
||||
pub fn show_window_menu(&self, position: impl Into<Position>) {
|
||||
let position = position.into();
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.show_window_menu(position))
|
||||
}
|
||||
|
||||
/// Modifies whether the window catches cursor events.
|
||||
///
|
||||
/// If `true`, the window will catch the cursor events. If `false`, events are passed through
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue