AprilNEA / AprilNEA/OpenLogi

[Bug]: First raw-XY sample after GestureButton press is not discarded — poisons swipe accumulator with spurious deltas

Open Beginner friendly
#752 1 comment 1 reaction 0 assignees View on GitHub
area: hidpp platform: all type: bug
Dominant language
Rust
Stars
21k
Forks
675
Avg merge
1d 6h
Merged PRs (30d)
180

Description

## Describe the bug

The dedicated GestureButton (CID `0x00C3`) does not discard its first raw-XY sample after press, unlike the HapticPanel (CID `0x01A0`) which does via `skip_first_raw_xy`. The first sample carries accumulated noise from the HID++ raw-XY divert buffer — not real movement — and poisons the `SwipeAccumulator`, causing wrong-direction commits.

## To reproduce

1. Press and hold the GestureButton on an MX-line mouse (MX Master 3/4)
2. Immediately swipe in a horizontal direction (e.g. right)
3. The committed direction is wrong (e.g. Down instead of Right)

## Expected behavior

The first raw-XY sample after **any** gesture source press should be discarded, not just the HapticPanel. The HID++ raw-XY divert begins sending accumulated deltas from the moment the divert is activated, not from the moment the user starts moving — the first report dumps buffered noise.

## Logs

```
swipe accumulate raw_dx=-81 raw_dy=592 ← first sample, massive dy
swipe accumulate raw_dx=0 raw_dy=1 accum_dx=-81 accum_dy=593
swipe accumulate raw_dx=3 raw_dy=0 accum_dx=-78 accum_dy=593
...
swipe accumulate raw_dx=28 raw_dy=0 accum_dx=142 accum_dy=598 held_long_enough=true
swipe COMMIT dir=Down accum_dx=142 accum_dy=598 ← wrong direction
```

All deltas after the first are `dx>0, dy=0` (clear rightward swipe), but `dy=598` from the first sample dominates the accumulator and forces Down.

## Root cause

`openlogi-hid/src/gesture.rs`, `handle_reprog`:

```rust
acc.skip_first_raw_xy = cid == reprog_controls::HAPTIC_PANEL_CID
&& !acc.gestures_down.contains(&cid);
```

Only the HapticPanel gets the discard. The GestureButton — the primary gesture source on most MX mice — does not, despite exhibiting the same first-sample noise from the HID++ raw-XY divert buffer.

## Environment

- Device: MX Master 4 over Bolt receiver (also affects MX Master 3/3S)
- OS: Linux (niri), likely all platforms
- OpenLogi version: 0.7.1, likely all versions with HID++ gesture support

## Related area(s)

- [x] Button actions / remapping
- [ ] GUI
- [ ] CLI
- [ ] DPI
- [ ] SmartShift
- [ ] Per-application profiles
- [ ] Configuration (TOML)
- [ ] Auto-update
- [ ] Other

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in openlogi-hid/src/gesture.rs at handle_reprog and compare the existing HapticPanel skip_first_raw_xy behavior with GestureButton handling. Reproduce or inspect the swipe accumulation logs, then verify that the first raw-XY sample after a GestureButton press is discarded while HapticPanel behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.