From 0c7f261c4af7392c5f103d1451e9d4e94c447ad3 Mon Sep 17 00:00:00 2001 From: Matthew Griffin <45285214+matthew-griffin@users.noreply.github.com> Date: Wed, 12 Jun 2019 15:48:14 +0100 Subject: [PATCH] Fix position for wxContextMenuEvent generated from keyboard The position was wrong for the keyboard-triggered menu events in wxWindows containing multiple sub-windows, such as wxListCtrl. Closes https://github.com/wxWidgets/wxWidgets/pull/1352 --- src/qt/window.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qt/window.cpp b/src/qt/window.cpp index 2eb51fee4b..cabf652879 100644 --- a/src/qt/window.cpp +++ b/src/qt/window.cpp @@ -1568,7 +1568,11 @@ bool wxWindowQt::QtHandleCloseEvent ( QWidget *handler, QCloseEvent *WXUNUSED( e bool wxWindowQt::QtHandleContextMenuEvent ( QWidget *WXUNUSED( handler ), QContextMenuEvent *event ) { wxContextMenuEvent e( wxEVT_CONTEXT_MENU, GetId() ); - e.SetPosition( wxQtConvertPoint( event->globalPos() ) ); + e.SetPosition( + event->reason() == QContextMenuEvent::Keyboard + ? wxDefaultPosition + : wxQtConvertPoint( event->globalPos() ) + ); e.SetEventObject(this); return ProcessWindowEvent( e );