Add WXWNDPROC typedef and use it in wxMSW instead of WXFARPROC

WNDPROC and FARPROC are not the same thing in MSW and it's wrong to use
WXFARPROC as the type of different window procedures we use.

Introduce WXWNDPROC which is more clear and correct and use it instead.

Also get rid of a few casts which are not necessary any longer.
This commit is contained in:
Vadim Zeitlin
2018-05-28 23:10:13 +02:00
parent 7624e31a95
commit 4230cb24de
8 changed files with 24 additions and 20 deletions

View File

@@ -1248,7 +1248,7 @@ void wxWindowMSW::SubclassWin(WXHWND hWnd)
wxAssociateWinWithHandle(hwnd, this);
m_oldWndProc = (WXFARPROC)wxGetWindowProc((HWND)hWnd);
m_oldWndProc = wxGetWindowProc((HWND)hWnd);
// we don't need to subclass the window of our own class (in the Windows
// sense of the word)
@@ -1291,7 +1291,7 @@ void wxWindowMSW::UnsubclassWin()
{
if ( !wxCheckWindowWndProc((WXHWND)hwnd) )
{
wxSetWindowProc(hwnd, (WNDPROC)m_oldWndProc);
wxSetWindowProc(hwnd, m_oldWndProc);
}
m_oldWndProc = NULL;
@@ -1322,8 +1322,7 @@ void wxWindowMSW::DissociateHandle()
}
bool wxCheckWindowWndProc(WXHWND hWnd,
WXFARPROC WXUNUSED(wndProc))
bool wxCheckWindowWndProc(WXHWND hWnd, WXWNDPROC WXUNUSED(wndProc))
{
const wxString str(wxGetWindowClass(hWnd));
@@ -2408,7 +2407,7 @@ WXLRESULT wxWindowMSW::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM l
{
WXLRESULT rc;
if ( m_oldWndProc )
rc = ::CallWindowProc(CASTWNDPROC m_oldWndProc, GetHwnd(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
rc = ::CallWindowProc(m_oldWndProc, GetHwnd(), nMsg, wParam, lParam);
else
rc = ::DefWindowProc(GetHwnd(), nMsg, wParam, lParam);