I have an issue with touch input events on Windows. I am developing a .NET WPF application with CefSharp (a C# wrapper for CEF, the Chromium Embedded Framework). In this application, I use a global
low-level mouse hook as outlined below to detect and react upon a
touch gesture (namely a swipe from the left edge of the screen). This
all works fine unless I perform the gesture over the browser content (i.e. the embedded browser control), then all touch
input is somehow swallowed or blocked and my mouse hook does
not register any events at all. The same behavior applies to the CEF
sample application and even Google Chrome, so it does not appear to be a
CefSharp or CEF issue. The strange thing is that the hook works as
expected for actual mouse events, those are fired even when performed
over the browser content.
User32.SetWindowsHookEx(WH_MOUSE_LL, ...);
...
private IntPtr LowLevelMouseProc(int nCode, IntPtr wParam, IntPtr lParam)
{
if (nCode >= 0)
{
var mouseData = (MSLLHOOKSTRUCT) Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT));
var extraInfo = mouseData.DwExtraInfo.ToUInt32();
var isTouch = (extraInfo & MOUSEEVENTF_MASK) == MOUSEEVENTF_FROMTOUCH;
if (isTouch)
{
...
}
}
return User32.CallNextHookEx(...);
}