Win32 Event Hook & Touch Input

766 views
Skip to first unread message

Damian Büchel

unread,
Apr 9, 2019, 10:39:24 AM4/9/19
to Chromium-dev
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(...);
}

Peconia

unread,
Apr 24, 2020, 8:32:58 PM4/24/20
to Chromium-dev
Hi there,

I have the same issue. Did you ever find out a reason for this or a way to get the touch events?

Many thanks
Reply all
Reply to author
Forward
0 new messages