From ec7fe2dfcc62d49dd08ab03ebb385a74118c5934 Mon Sep 17 00:00:00 2001 From: David Bailes Date: Mon, 20 Mar 2017 13:23:59 +0000 Subject: [PATCH] Fix for bug 613: menu key deselects track. When the menu key is pressed, mouse events are also generated, and one of these was interpreted as a mouse click outside the tracks, which deselected the tracks. A possible fix would have been to make a change in TrackPanel::HandleTrackSpecificMouseEvent() so that only left clicks outside of tracks would deselect tracks. However, I decided that a better fix was to modify TrackPanel::OnMouseEvent to ignore the mouse events generated when the menu key is pressed. This should prevent these mouse events from causing bugs in any new code. --- src/TrackPanel.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 118bbbbd9..ec0bee7b8 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -6075,6 +6075,16 @@ try } #endif + // If a mouse event originates from a keyboard context menu event then + // event.GetPosition() == wxDefaultPosition. wxContextMenu events are handled in + // TrackPanel::OnContextMenu(), and therefore associated mouse events are ignored here. + // Not ignoring them was causing bug 613: the mouse events were interpreted as clicking + // outside the tracks. + if (event.GetPosition() == wxDefaultPosition && (event.RightDown() || event.RightUp())) { + event.Skip(); + return; + } + if (event.m_wheelRotation != 0) HandleWheelRotation(event);