Commit 41de6d6
authored
feat: XI2.1 smooth scroll support via xinput driver (#12)
## Summary
Enable pixel-precise smooth scrolling by sending raw pixel deltas
through the `xf86-input-neko` xinput driver instead of quantizing them
into discrete XTest button events.
### Changes
**`server/internal/desktop/xorg.go`** — `Scroll()` now sends raw pixel
deltas directly to the xinput driver via Unix socket. Falls back to
XTest if the driver connection fails.
**`server/internal/webrtc/legacyhandler.go`** — Support
`PayloadScrollWithCtrl` (length=5) binary message format that includes a
`controlKey` byte alongside `deltaX`/`deltaY`.
**`server/pkg/xinput/`** — Add `NEKO_SCROLL` (0x80) message type and
`Scroll(deltaX, deltaY int32)` method to send scroll events over the
Unix socket to the Xorg driver.
**`server/pkg/xorg/xorg.c`** — Fix XTest fallback scroll direction
(button 4/5 mapping was inverted).
**`server/internal/config/desktop.go`** — Add `CDPScrollURL` config
option (unused by default, for optional CDP scroll bypass).
**`server/pkg/cdpscroll/`** — Optional CDP-based scroll client (gated
behind `CDPScrollURL` config, not active by default).
### Context
Used by
[kernel/kernel-images#196](kernel/kernel-images#196)
which extends the `xf86-input-neko` Xorg driver with XI2.1 scroll
valuators. Together, this achieves 1:1 pixel mapping between client
trackpad deltas and browser scroll.
Made with [Cursor](https://cursor.com)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes desktop input/scroll handling (including modifier behavior and
X11 button mapping), which can impact core interaction and has
platform-specific edge cases. Failover paths mitigate risk but need
validation across driver/no-driver setups.
>
> **Overview**
> Adds XI2.1 *smooth/pixel-precise* scrolling support by routing scroll
deltas through the `xinput` Unix-socket driver when
`desktop.input.enabled` is set, including temporarily setting the Ctrl
modifier before posting the event and falling back to XTest on driver
errors.
>
> Extends the legacy WebRTC data-channel scroll payload to optionally
include a Ctrl flag (`Length == 5`) while keeping the existing scroll
format for compatibility, and updates logging accordingly.
>
> Expands `server/pkg/xinput` with a new `NEKO_SCROLL` message and
`Driver.Scroll()` API (dummy returns a not-connected error), and fixes
the XTest fallback scroll direction mapping in `server/pkg/xorg/xorg.c`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ae3594a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent abe9ac5 commit 41de6d6
8 files changed
Lines changed: 78 additions & 18 deletions
File tree
- server
- internal
- desktop
- webrtc
- pkg
- xinput
- xorg
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
23 | 37 | | |
24 | 38 | | |
25 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
| |||
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
79 | 99 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
85 | 104 | | |
86 | | - | |
| 105 | + | |
| 106 | + | |
87 | 107 | | |
88 | 108 | | |
89 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
482 | 481 | | |
483 | 482 | | |
484 | 483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
4 | 9 | | |
5 | 10 | | |
6 | 11 | | |
| |||
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
0 commit comments