Skip to content

Precision Touchpads #9

@leofidus

Description

@leofidus

As stated in the readme, some touchpads don't work. This is because src/rawinput.rs#L77 skips events if the device is not found in the device map, but precision touchpads actually send mouse events with hDevice == NULL.

To quote Eric Brown on SO: "If the touchpad is a precision touchpad, the input has had some filtering/transformations done on it at the kernel level, and (IIRC) the device handle is intentionally not passed".

I'm not sure about the best way to incorporate this into this library. Just setting pos to some magic value for mouse messages with hDevice == 0 works but obviously isn't nice. Turning pos into an Option would be "correct" but makes the library less ergonomic. Maybe a "fake" device in the device list for this purpose?

Also this isn't the only time I've observed hDevice == 0, it also happens when software like AutoHotkey controls the pointer (e.g. when it clicks). In my software I've used the extraInfo field as a heuristic here: it's always 0 for touchpads but always holds a value for AutoHotkey actions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions