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.
This commit is contained in:
parent
7a1e105036
commit
f93a6d740a
4 changed files with 37 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ pub use state::State;
|
|||
|
||||
use crate::conversion;
|
||||
use crate::core;
|
||||
use crate::core::mouse;
|
||||
use crate::core::renderer;
|
||||
use crate::core::widget::operation;
|
||||
use crate::core::window;
|
||||
|
|
@ -1058,6 +1059,20 @@ fn run_command<A, C, E>(
|
|||
.set_window_level(conversion::window_level(level));
|
||||
}
|
||||
}
|
||||
window::Action::ShowWindowMenu(id) => {
|
||||
if let Some(window) = window_manager.get_mut(id) {
|
||||
if let mouse::Cursor::Available(point) =
|
||||
window.state.cursor()
|
||||
{
|
||||
window.raw.show_window_menu(
|
||||
winit::dpi::LogicalPosition {
|
||||
x: point.x,
|
||||
y: point.y,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
window::Action::FetchId(id, tag) => {
|
||||
if let Some(window) = window_manager.get_mut(id) {
|
||||
proxy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue