Fix client to screen translation in wxWindowMSW::PopupMenu().
Use wxWidgets ClientToScreen() function for computing the screen coordinates of the popup menu instead of Windows ::ClientToScreen() as the latter doesn't know about the toolbar which may be present in wxFrame and excluded from the client area. Closes #13223. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67758 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2213,18 +2213,16 @@ bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y)
|
||||
{
|
||||
menu->UpdateUI();
|
||||
|
||||
wxPoint pt;
|
||||
if ( x == wxDefaultCoord && y == wxDefaultCoord )
|
||||
{
|
||||
wxPoint mouse = ScreenToClient(wxGetMousePosition());
|
||||
x = mouse.x; y = mouse.y;
|
||||
pt = wxGetMousePosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
pt = ClientToScreen(wxPoint(x, y));
|
||||
}
|
||||
|
||||
HWND hWnd = GetHwnd();
|
||||
HMENU hMenu = GetHmenuOf(menu);
|
||||
POINT point;
|
||||
point.x = x;
|
||||
point.y = y;
|
||||
::ClientToScreen(hWnd, &point);
|
||||
#if defined(__WXWINCE__)
|
||||
static const UINT flags = 0;
|
||||
#else // !__WXWINCE__
|
||||
@@ -2242,7 +2240,7 @@ bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y)
|
||||
}
|
||||
#endif // __WXWINCE__/!__WXWINCE__
|
||||
|
||||
::TrackPopupMenu(hMenu, flags, point.x, point.y, 0, hWnd, NULL);
|
||||
::TrackPopupMenu(GetHmenuOf(menu), flags, pt.x, pt.y, 0, GetHwnd(), NULL);
|
||||
|
||||
// we need to do it right now as otherwise the events are never going to be
|
||||
// sent to wxCurrentPopupMenu from HandleCommand()
|
||||
|
Reference in New Issue
Block a user