From 0446382e82ef1d81613bcb09d473f71d2cb3401c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 16 May 2018 15:23:00 +0200 Subject: [PATCH] Fix position of popup menus in wxGenericListCtrl The position was off by the header height due to a missing translation between wxGenericListCtrl and wxListMainWindow, in which the menu is actually shown, coordinates. Closes #18133. --- src/generic/listctrl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 1ea2442ffa..73773de48c 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -5467,6 +5467,12 @@ wxColour wxGenericListCtrl::GetForegroundColour() const bool wxGenericListCtrl::DoPopupMenu( wxMenu *menu, int x, int y ) { #if wxUSE_MENUS + // Coordinates here are given in this control coordinates system, but + // PopupMenu() wants them in the coordinates system of the window it's + // called on, so transform them. + ClientToScreen(&x, &y); + m_mainWin->ScreenToClient(&x, &y); + return m_mainWin->PopupMenu( menu, x, y ); #else return false;