Fall back on ::GetMessagePos() if ::GetCursorPos() fails under MSW.

In some rare but reproducible cases GetCursorPos() can fail and return without
filling in the provided point. Fall back to GetMessagePos() if this happens:
this is not ideal but clearly better than using uninitialized position or hard
coding something like (0, 0).

Closes #13664.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69758 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-11-14 12:51:53 +00:00
parent 3e6807d701
commit d6c37f5bc4
6 changed files with 29 additions and 54 deletions

View File

@@ -1905,9 +1905,8 @@ int WXDLLIMPEXP_CORE wxMSWGetColumnClicked(NMHDR *nmhdr, POINT *ptClick)
}
else
#endif //__WXWINCE__
if ( !::GetCursorPos(ptClick) )
{
wxLogLastError(wxT("GetCursorPos"));
wxGetCursorPosMSW(ptClick);
}
// we need to use listctrl coordinates for the event point so this is what
@@ -2323,7 +2322,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
else
#endif //__WXWINCE__
{
::GetCursorPos(&(lvhti.pt));
wxGetCursorPosMSW(&(lvhti.pt));
}
::ScreenToClient(GetHwnd(), &lvhti.pt);