From cbbd7b44b24a51654136cd9fd1390b64c15e0899 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 16 Mar 2017 23:36:54 +0100 Subject: [PATCH] Propagate EVT_CONTEXT_MENU if standard Scintilla context menu wasn't displayed EVT_CONTEXT_MENU event should be consumed in the event handler only if Scintilla context menu was actually displayed. --- src/stc/ScintillaWX.cpp | 6 +++++- src/stc/ScintillaWX.h | 2 +- src/stc/stc.cpp | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 02b31da0ad..14349aaafb 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -1143,9 +1143,13 @@ void ScintillaWX::DoCommand(int ID) { } -void ScintillaWX::DoContextMenu(Point pt) { +bool ScintillaWX::DoContextMenu(Point pt) { if (ShouldDisplayPopup(pt)) + { ContextMenu(pt); + return true; + } + return false; } void ScintillaWX::DoOnListBox() { diff --git a/src/stc/ScintillaWX.h b/src/stc/ScintillaWX.h index 41c39b4146..720efc3134 100644 --- a/src/stc/ScintillaWX.h +++ b/src/stc/ScintillaWX.h @@ -179,7 +179,7 @@ public: #endif void DoCommand(int ID); - void DoContextMenu(Point pt); + bool DoContextMenu(Point pt); void DoOnListBox(); diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 7b35607b8c..f67ee92846 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -5248,7 +5248,8 @@ void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) { if (ht != wxHT_WINDOW_INSIDE) { pt = this->PointFromPosition(this->GetCurrentPos()); } - m_swx->DoContextMenu(Point(pt.x, pt.y)); + if ( !m_swx->DoContextMenu(Point(pt.x, pt.y)) ) + evt.Skip(); }