Use WinStruct<> to initialize GESTUREINFO

This is more concise and clear than initializing it manually.
This commit is contained in:
Vadim Zeitlin
2017-11-21 16:09:43 +01:00
parent 7ffb897810
commit daf19c652c

View File

@@ -3206,12 +3206,10 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
if ( !GestureFuncs::IsOk() ) if ( !GestureFuncs::IsOk() )
break; break;
// gestureInfo will contain the information about the gesture HGESTUREINFO hGestureInfo = reinterpret_cast<HGESTUREINFO>(lParam);
GESTUREINFO gestureInfo = {0};
gestureInfo.cbSize = sizeof(GESTUREINFO);
// This should fill gestureInfo with the gesture details WinStruct<GESTUREINFO> gestureInfo;
if ( !GestureFuncs::GetGestureInfo()((HGESTUREINFO)lParam, &gestureInfo) ) if ( !GestureFuncs::GetGestureInfo()(hGestureInfo, &gestureInfo) )
{ {
wxLogLastError("GetGestureInfo"); wxLogLastError("GetGestureInfo");
break; break;
@@ -3278,7 +3276,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
if ( processed ) if ( processed )
{ {
// If processed, we must call this to avoid memory leaks // If processed, we must call this to avoid memory leaks
if ( !GestureFuncs::CloseGestureInfoHandle()((HGESTUREINFO)lParam) ) if ( !GestureFuncs::CloseGestureInfoHandle()(hGestureInfo) )
{ {
wxLogLastError("CloseGestureInfoHandle"); wxLogLastError("CloseGestureInfoHandle");
} }