From ba7dc2586ba77a18be8ac78b6fe12a65b86a7c4d Mon Sep 17 00:00:00 2001 From: Thomas McAuliffe Date: Tue, 2 May 2023 21:03:57 +0100 Subject: [PATCH] Fix horizontal scrolling on trackpad (#8403) Adds check to mouse scrolling to see if horizontal scrolling is possible Fix #7772 Co-authored-by: Thomas McAuliffe --- dev/WebView2/WebView2.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dev/WebView2/WebView2.cpp b/dev/WebView2/WebView2.cpp index a3239b261e..51939c6bc2 100644 --- a/dev/WebView2/WebView2.cpp +++ b/dev/WebView2/WebView2.cpp @@ -335,7 +335,18 @@ void WebView2::HandlePointerWheelChanged(const winrt::Windows::Foundation::IInsp { // Chromium handles WM_MOUSEXXX for mouse, WM_POINTERXXX for touch winrt::PointerDeviceType deviceType{ args.Pointer().PointerDeviceType() }; - UINT message = deviceType == winrt::PointerDeviceType::Mouse ? WM_MOUSEWHEEL : WM_POINTERWHEEL; + winrt::PointerPoint pointerPoint{ args.GetCurrentPoint(*this) }; + winrt::PointerPointProperties properties{ pointerPoint.Properties() }; + UINT message; + + if (deviceType == winrt::PointerDeviceType::Mouse) + { + message = properties.IsHorizontalMouseWheel() ? WM_MOUSEHWHEEL : WM_MOUSEWHEEL; + } + else + { + message = WM_POINTERWHEEL; + } OnXamlPointerMessage(message, args); }