From 9be1e9aab182db1ad4f63e07d50229944c6a70da Mon Sep 17 00:00:00 2001 From: Remco Smits Date: Fri, 16 May 2025 15:43:12 +0200 Subject: [PATCH] debugger: Prevent pane context menu from showing on secondary mouse click in list entries (#30781) This PR prevents the debug panel pane context menu from showing when you click your secondary mouse button in **stackframe**, **breakpoint** and **module** list entries. Release Notes: - N/A --- .../src/session/running/breakpoint_list.rs | 20 +++++++++++++++++-- .../src/session/running/module_list.rs | 3 +++ .../src/session/running/stack_frame_list.rs | 6 ++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/crates/debugger_ui/src/session/running/breakpoint_list.rs b/crates/debugger_ui/src/session/running/breakpoint_list.rs index a8917e84e588d1a2265a8f19696b40f6111c7217..8b563517968ebecb24c5596153f23d24570edd79 100644 --- a/crates/debugger_ui/src/session/running/breakpoint_list.rs +++ b/crates/debugger_ui/src/session/running/breakpoint_list.rs @@ -21,8 +21,8 @@ use project::{ use ui::{ App, Clickable, Color, Context, Div, Icon, IconButton, IconName, Indicator, InteractiveElement, IntoElement, Label, LabelCommon, LabelSize, ListItem, ParentElement, Render, RenderOnce, - Scrollbar, ScrollbarState, SharedString, StatefulInteractiveElement, Styled, Window, div, - h_flex, px, v_flex, + Scrollbar, ScrollbarState, SharedString, StatefulInteractiveElement, Styled, Tooltip, Window, + div, h_flex, px, v_flex, }; use util::{ResultExt, maybe}; use workspace::Workspace; @@ -259,6 +259,11 @@ impl LineBreakpoint { dir, name, line ))) .cursor_pointer() + .tooltip(Tooltip::text(if breakpoint.state.is_enabled() { + "Disable Breakpoint" + } else { + "Enable Breakpoint" + })) .on_click({ let weak = weak.clone(); let path = path.clone(); @@ -290,6 +295,9 @@ impl LineBreakpoint { ))) .start_slot(indicator) .rounded() + .on_secondary_mouse_down(|_, _, cx| { + cx.stop_propagation(); + }) .end_hover_slot( IconButton::new( SharedString::from(format!( @@ -423,12 +431,20 @@ impl ExceptionBreakpoint { self.id ))) .rounded() + .on_secondary_mouse_down(|_, _, cx| { + cx.stop_propagation(); + }) .start_slot( div() .id(SharedString::from(format!( "exception-breakpoint-ui-item-{}-click-handler", self.id ))) + .tooltip(Tooltip::text(if self.is_enabled { + "Disable Exception Breakpoint" + } else { + "Enable Exception Breakpoint" + })) .on_click(move |_, _, cx| { list.update(cx, |this, cx| { this.session.update(cx, |this, cx| { diff --git a/crates/debugger_ui/src/session/running/module_list.rs b/crates/debugger_ui/src/session/running/module_list.rs index 03366231dbd18c69b4ecec55c39795d8e86a6f8b..3ca829fcb267491d5601e856d779ff35509399bc 100644 --- a/crates/debugger_ui/src/session/running/module_list.rs +++ b/crates/debugger_ui/src/session/running/module_list.rs @@ -129,6 +129,9 @@ impl ModuleList { .w_full() .group("") .id(("module-list", ix)) + .on_any_mouse_down(|_, _, cx| { + cx.stop_propagation(); + }) .when(module.path.is_some(), |this| { this.on_click({ let path = module diff --git a/crates/debugger_ui/src/session/running/stack_frame_list.rs b/crates/debugger_ui/src/session/running/stack_frame_list.rs index efa2dbae63012a3fbfca1f7bdd76836f2e13f3c4..cf97e3d763d068523538034ac01a1a15a03c1246 100644 --- a/crates/debugger_ui/src/session/running/stack_frame_list.rs +++ b/crates/debugger_ui/src/session/running/stack_frame_list.rs @@ -393,6 +393,9 @@ impl StackFrameList { .when(is_selected_frame, |this| { this.bg(cx.theme().colors().element_hover) }) + .on_any_mouse_down(|_, _, cx| { + cx.stop_propagation(); + }) .on_click(cx.listener(move |this, _, window, cx| { this.selected_ix = Some(ix); this.activate_selected_entry(window, cx); @@ -480,6 +483,9 @@ impl StackFrameList { .when(is_selected, |this| { this.bg(cx.theme().colors().element_hover) }) + .on_any_mouse_down(|_, _, cx| { + cx.stop_propagation(); + }) .on_click(cx.listener(move |this, _, window, cx| { this.selected_ix = Some(ix); this.activate_selected_entry(window, cx);