Use the same definitions of wx{Get,Set}WindowXXX() in Win{32,64}
By now all compilers/SDKs should hopefully have {Get,Set}WindowLongPtr() and GWLP_XXX constants, so there is no reason to keep separate, and differing by return type in wxGetWindowProc() case (oversight?), versions of these functions for Win32 and Win64 builds. Combine them in a single version appropriate for both cases.
This commit is contained in:
@@ -1058,54 +1058,28 @@ inline void wxFillRect(HWND hwnd, HDC hdc, HBRUSH hbr)
|
||||
// 32/64 bit helpers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __WIN64__
|
||||
|
||||
inline void *wxGetWindowProc(HWND hwnd)
|
||||
{
|
||||
return (void *)::GetWindowLongPtr(hwnd, GWLP_WNDPROC);
|
||||
}
|
||||
|
||||
inline void *wxGetWindowUserData(HWND hwnd)
|
||||
{
|
||||
return (void *)::GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
}
|
||||
|
||||
inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func)
|
||||
{
|
||||
return (WNDPROC)::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)func);
|
||||
}
|
||||
|
||||
inline void *wxSetWindowUserData(HWND hwnd, void *data)
|
||||
{
|
||||
return (void *)::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
|
||||
}
|
||||
|
||||
#else // __WIN32__
|
||||
|
||||
// note that the casts to LONG_PTR here are required even on 32-bit machines
|
||||
// for the 64-bit warning mode of later versions of MSVC (C4311/4312)
|
||||
inline WNDPROC wxGetWindowProc(HWND hwnd)
|
||||
{
|
||||
return (WNDPROC)(LONG_PTR)::GetWindowLong(hwnd, GWL_WNDPROC);
|
||||
return (WNDPROC)(LONG_PTR)::GetWindowLongPtr(hwnd, GWLP_WNDPROC);
|
||||
}
|
||||
|
||||
inline void *wxGetWindowUserData(HWND hwnd)
|
||||
{
|
||||
return (void *)(LONG_PTR)::GetWindowLong(hwnd, GWL_USERDATA);
|
||||
return (void *)(LONG_PTR)::GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
}
|
||||
|
||||
inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func)
|
||||
{
|
||||
return (WNDPROC)(LONG_PTR)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR)func);
|
||||
return (WNDPROC)(LONG_PTR)::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)func);
|
||||
}
|
||||
|
||||
inline void *wxSetWindowUserData(HWND hwnd, void *data)
|
||||
{
|
||||
return (void *)(LONG_PTR)::SetWindowLong(hwnd, GWL_USERDATA, (LONG_PTR)data);
|
||||
return (void *)(LONG_PTR)::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
|
||||
}
|
||||
|
||||
#endif // __WIN64__/__WIN32__
|
||||
|
||||
#endif // wxUSE_GUI && __WXMSW__
|
||||
|
||||
#endif // _WX_PRIVATE_H_
|
||||
|
Reference in New Issue
Block a user