From 6d0cb403a9e998fbd1d4d27421ccc8849d067965 Mon Sep 17 00:00:00 2001 From: New Pagodi Date: Sun, 8 Oct 2017 10:11:46 +0200 Subject: [PATCH] Prevent sending EVT_MOUSE_CAPTURE_LOST while opening a context menu in wxSTC At least under wxMSW and wxGTK opening a popup menu when mouse is captured generates EVT_MOUSE_CAPTURE_LOST. We would like to avoid this and to release capture in a controlled way. See #17961. --- src/stc/ScintillaWX.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index f9dbe55696..992f94cc64 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -1165,6 +1165,10 @@ void ScintillaWX::DoCommand(int ID) { bool ScintillaWX::DoContextMenu(Point pt) { if (ShouldDisplayPopup(pt)) { + // To prevent generating EVT_MOUSE_CAPTURE_LOST. + if ( HaveMouseCapture() ) { + SetMouseCapture(false); + } ContextMenu(pt); return true; }