From 19dcd63e0490cb8a8c990f96479189ad9b5f2bdd Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 9 May 2026 13:08:33 +0200 Subject: [PATCH] MMB rewiring uses Bubble + handledEventsToo to observe press MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Tunnel-phase subscription on PointerPressed was silently never firing for middle-clicks on metadata rows — ProDataGrid's row-level pointer handlers appear to claim the event before our tunnel subscription gets a turn, so MMB-on-a-row went nowhere despite the unit tests (which call RaiseRowActivated directly) staying green. Switching to Bubble + handledEventsToo: true gives us a guaranteed seat regardless of who marked the event handled along the way. Both the assembly-tree and the metadata-grid MMB handlers move together for consistency. Assisted-by: Claude:claude-opus-4-7:Claude Code --- ILSpy/AssemblyTree/AssemblyListPane.axaml.cs | 8 +++++--- ILSpy/Views/MetadataTablePage.axaml.cs | 10 +++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ILSpy/AssemblyTree/AssemblyListPane.axaml.cs b/ILSpy/AssemblyTree/AssemblyListPane.axaml.cs index f5142b9d6..53d6b7ae9 100644 --- a/ILSpy/AssemblyTree/AssemblyListPane.axaml.cs +++ b/ILSpy/AssemblyTree/AssemblyListPane.axaml.cs @@ -50,10 +50,12 @@ namespace ILSpy.AssemblyTree InitializeComponent(); TreeGrid.DoubleTapped += OnTreeGridDoubleTapped; TreeGrid.KeyDown += OnTreeGridKeyDown; - // Tunnelling subscription so the MMB is observed before the DataGrid's own - // pointer handling claims it. + // Bubble + handledEventsToo: ProDataGrid's row-level pointer handlers mark + // PointerPressed handled before bubble reaches our subscription, so we have to + // opt into "see handled events too" to react. TreeGrid.AddHandler(PointerPressedEvent, OnTreeGridPointerPressed, - global::Avalonia.Interactivity.RoutingStrategies.Tunnel); + global::Avalonia.Interactivity.RoutingStrategies.Bubble, + handledEventsToo: true); // Context-menu host. Tests bypass this and re-attach via AttachContextMenu so they // can inject stub entries — at app-runtime we resolve the registry through the diff --git a/ILSpy/Views/MetadataTablePage.axaml.cs b/ILSpy/Views/MetadataTablePage.axaml.cs index c0251cb34..1ef5ec8d0 100644 --- a/ILSpy/Views/MetadataTablePage.axaml.cs +++ b/ILSpy/Views/MetadataTablePage.axaml.cs @@ -61,10 +61,14 @@ namespace ILSpy.Views if (grid is not null) { grid.DoubleTapped += OnGridDoubleTapped; - // Subscribe at the tunnelling phase so the middle-click is observed before - // the DataGrid's own selection / scroll handling can swallow it. + // Bubble + handledEventsToo: ProDataGrid's row-level pointer handlers mark + // PointerPressed handled before bubble reaches our subscription, so we have to + // opt into "see handled events too" to react. Tunnel was tried first but + // ProDataGrid's hierarchy seemingly intercepts the tunnel pass for non-primary + // buttons — bubble + handledEventsToo is the reliable path. grid.AddHandler(PointerPressedEvent, OnGridPointerPressed, - global::Avalonia.Interactivity.RoutingStrategies.Tunnel); + global::Avalonia.Interactivity.RoutingStrategies.Bubble, + handledEventsToo: true); } }