fix(context_menu): place the context_menu in the correct place in X11
This commit is contained in:
parent
37c392a470
commit
645ca8b906
1 changed files with 4 additions and 4 deletions
|
|
@ -427,6 +427,7 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
||||||
self.create_popup(layout, cursor, renderer, shell, viewport, state);
|
self.create_popup(layout, cursor, renderer, shell, viewport, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shell.request_redraw();
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
return;
|
return;
|
||||||
} else if !was_open && right_button_released(event)
|
} else if !was_open && right_button_released(event)
|
||||||
|
|
@ -489,9 +490,8 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut bounds = layout.bounds();
|
// Anchor the menu to a 1x1 rectangle at the click, like the popup path does
|
||||||
bounds.x = state.context_cursor.x;
|
let bounds = iced::Rectangle::new(state.context_cursor, Size::new(1.0, 1.0));
|
||||||
bounds.y = state.context_cursor.y;
|
|
||||||
Some(
|
Some(
|
||||||
crate::widget::menu::Menu {
|
crate::widget::menu::Menu {
|
||||||
tree: state.menu_bar_state.clone(),
|
tree: state.menu_bar_state.clone(),
|
||||||
|
|
@ -506,7 +506,7 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
||||||
item_width: ItemWidth::Uniform(240),
|
item_width: ItemWidth::Uniform(240),
|
||||||
item_height: ItemHeight::Dynamic(40),
|
item_height: ItemHeight::Dynamic(40),
|
||||||
bar_bounds: bounds,
|
bar_bounds: bounds,
|
||||||
main_offset: -(bounds.height as i32),
|
main_offset: 0,
|
||||||
cross_offset: 0,
|
cross_offset: 0,
|
||||||
root_bounds_list: vec![bounds],
|
root_bounds_list: vec![bounds],
|
||||||
path_highlight: Some(PathHighlight::MenuActive),
|
path_highlight: Some(PathHighlight::MenuActive),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue