Browse Source

MMB rewiring uses Bubble + handledEventsToo to observe press

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
pull/3755/head
Siegfried Pammer 2 months ago
parent
commit
19dcd63e04
  1. 8
      ILSpy/AssemblyTree/AssemblyListPane.axaml.cs
  2. 10
      ILSpy/Views/MetadataTablePage.axaml.cs

8
ILSpy/AssemblyTree/AssemblyListPane.axaml.cs

@ -50,10 +50,12 @@ namespace ILSpy.AssemblyTree @@ -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

10
ILSpy/Views/MetadataTablePage.axaml.cs

@ -61,10 +61,14 @@ namespace ILSpy.Views @@ -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);
}
}

Loading…
Cancel
Save