Skip to content

[Skia/X11] XInput2 wheel button presses (buttons 4-7) are raised as PointerPressed #26709

Backlog

Description

@michaelstonis

Current behavior 🐛

On the Skia X11 host with XInput2, a non-emulated XI_ButtonPress for buttons 4 to 7 (a wheel notch on a server or device without scroll valuators, for example Xvfb, a VNC/RDP session or some VMs) is raised as PointerPressed instead of PointerWheelChanged. The press has no button pressed (IsLeftButtonPressed and the others are false, PointerUpdateKind.Other), so controls that treat any press as a primary press act on it: one wheel notch selects the item under the pointer, two notches double-tap it.

Cause, as of 7.0.65, in X11PointerInputSource.XInput.cs CreatePointerEventArgsFromDeviceEvent:

(wheelDelta, isHorizontalMouseWheel) = data.detail switch
{
    1 << SCROLL_RIGHT => ...,
    1 << SCROLL_DOWN => ...,
    1 << SCROLL_LEFT => ...,
    1 << SCROLL_UP => ...,
    _ => (0, false)
};

For an XI2 device event detail is the button number (4 to 7), the same value the core-protocol path compares directly (ev.button is SCROLL_LEFT or SCROLL_RIGHT or SCROLL_UP or SCROLL_DOWN). Comparing it with 1 << 4 … 1 << 7 (16 to 128) never matches, so MouseWheelDelta stays 0 and the XI_ButtonPress case raises PointerPressed.

Expected behavior 🎯

Buttons 4 to 7 map to wheel deltas (data.detail switch { SCROLL_UP => ..., SCROLL_DOWN => ..., SCROLL_LEFT => ..., SCROLL_RIGHT => ... }) and raise PointerWheelChanged; the matching release is swallowed as it is today.

How to reproduce it (as minimally and precisely as possible)

  1. net10.0-desktop on Linux X11 under Xvfb; send a wheel notch with xdotool click 4 (seen on 6.7; the code above is unchanged in 7.0.65).
  2. Any element with PointerPressed / PointerWheelChanged handlers (seen on a SkiaSharp canvas control).
  3. Scroll one wheel notch over it: PointerPressed fires with no button pressed; PointerWheelChanged does not fire.

Workaround 🛠️

App side: ignore a PointerPressed whose point has no button pressed.

Works on UWP/WinUI 🤷

Yes

Affected platforms 📱💻🖥️

Skia (Linux X11)

Uno.Sdk version (and other relevant versions) 📦

Uno.Sdk 7.0.22 / Uno.WinUI 7.0.65 (first seen on 6.7), .NET 10.

Anything else we need to know? 💬

On a server with smooth-scroll valuators the wheel arrives as XI_Motion with valuator deltas plus emulated button events, which are ignored, so a normal desktop session does not show it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions