From 645ca8b90661ad4254b9c142e47a696f9b4274d8 Mon Sep 17 00:00:00 2001 From: Hojjat Date: Wed, 2 Sep 2026 18:01:55 -0600 Subject: [PATCH] fix(context_menu): place the context_menu in the correct place in X11 --- src/widget/context_menu.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widget/context_menu.rs b/src/widget/context_menu.rs index 6ee253fc..c006ef01 100644 --- a/src/widget/context_menu.rs +++ b/src/widget/context_menu.rs @@ -427,6 +427,7 @@ impl Widget self.create_popup(layout, cursor, renderer, shell, viewport, state); } + shell.request_redraw(); shell.capture_event(); return; } else if !was_open && right_button_released(event) @@ -489,9 +490,8 @@ impl Widget return None; } - let mut bounds = layout.bounds(); - bounds.x = state.context_cursor.x; - bounds.y = state.context_cursor.y; + // Anchor the menu to a 1x1 rectangle at the click, like the popup path does + let bounds = iced::Rectangle::new(state.context_cursor, Size::new(1.0, 1.0)); Some( crate::widget::menu::Menu { tree: state.menu_bar_state.clone(), @@ -506,7 +506,7 @@ impl Widget item_width: ItemWidth::Uniform(240), item_height: ItemHeight::Dynamic(40), bar_bounds: bounds, - main_offset: -(bounds.height as i32), + main_offset: 0, cross_offset: 0, root_bounds_list: vec![bounds], path_highlight: Some(PathHighlight::MenuActive),