From daf19c652c1ec37e8291b7a69ba99bae45726d8c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 21 Nov 2017 16:09:43 +0100 Subject: [PATCH] Use WinStruct<> to initialize GESTUREINFO This is more concise and clear than initializing it manually. --- src/msw/window.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 63d18e0c7a..bfcda345b7 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -3206,12 +3206,10 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, if ( !GestureFuncs::IsOk() ) break; - // gestureInfo will contain the information about the gesture - GESTUREINFO gestureInfo = {0}; - gestureInfo.cbSize = sizeof(GESTUREINFO); + HGESTUREINFO hGestureInfo = reinterpret_cast(lParam); - // This should fill gestureInfo with the gesture details - if ( !GestureFuncs::GetGestureInfo()((HGESTUREINFO)lParam, &gestureInfo) ) + WinStruct gestureInfo; + if ( !GestureFuncs::GetGestureInfo()(hGestureInfo, &gestureInfo) ) { wxLogLastError("GetGestureInfo"); break; @@ -3278,7 +3276,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, if ( processed ) { // If processed, we must call this to avoid memory leaks - if ( !GestureFuncs::CloseGestureInfoHandle()((HGESTUREINFO)lParam) ) + if ( !GestureFuncs::CloseGestureInfoHandle()(hGestureInfo) ) { wxLogLastError("CloseGestureInfoHandle"); }