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.
This commit is contained in:
New Pagodi 2017-10-08 10:11:46 +02:00 committed by Artur Wieczorek
parent 0fea881f12
commit 6d0cb403a9

View File

@ -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;
}