Skip to content

Commit 469c711

Browse files
committed
fix: eliminate scroll log spam and restore XTest controlKey atomicity
- Remove warn-level log on every scroll when xinput driver is unavailable (dummy driver returns error by design, not worth logging) - Pass controlKey to xorg.Scroll() in the XTest fallback path so the modifier set/scroll/clear happens atomically under a single X11 lock Made-with: Cursor
1 parent 7f3f305 commit 469c711

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

server/internal/desktop/xorg.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ func (manager *DesktopManagerCtx) GetCursorPosition() (int, int) {
1919
}
2020

2121
func (manager *DesktopManagerCtx) Scroll(deltaX, deltaY int, controlKey bool) {
22-
if controlKey {
23-
xorg.SetKeyboardModifier(xorg.KbdModControl, true)
24-
defer xorg.SetKeyboardModifier(xorg.KbdModControl, false)
22+
// Try xinput driver first (XI2.1 smooth scrolling via xf86-input-neko)
23+
if err := manager.input.Scroll(int32(deltaX), int32(deltaY)); err == nil {
24+
if controlKey {
25+
xorg.SetKeyboardModifier(xorg.KbdModControl, true)
26+
defer xorg.SetKeyboardModifier(xorg.KbdModControl, false)
27+
}
28+
return
2529
}
2630

27-
if err := manager.input.Scroll(int32(deltaX), int32(deltaY)); err != nil {
28-
manager.logger.Warn().Err(err).Msg("xinput scroll failed, falling back to XTest")
29-
xorg.Scroll(deltaX, deltaY, false)
30-
}
31+
// XTest fallback — handles controlKey atomically under a single X11 lock
32+
xorg.Scroll(deltaX, deltaY, controlKey)
3133
}
3234

3335
func (manager *DesktopManagerCtx) ButtonDown(code uint32) error {

0 commit comments

Comments
 (0)