Support scroll wheel and the missing modifier keysyms on uinput, and keep X11 capture when XTest is absent

This commit is contained in:
Viktor Liu
2026-09-22 19:58:14 +02:00
parent d1d8c19fc7
commit b703eb4409
2 changed files with 53 additions and 2 deletions
+15 -2
View File
@@ -10,12 +10,25 @@ import (
func newPlatformVNC() (vncserver.ScreenCapturer, vncserver.InputInjector, bool) {
// Prefer X11 when an X server is reachable. NewX11InputInjector probes
// DISPLAY (and /proc) eagerly, so a non-nil error here means no X.
// DISPLAY (and /proc) eagerly.
injector, err := vncserver.NewX11InputInjector("", "", "")
if err == nil {
return vncserver.NewX11Poller("", ""), injector, true
}
log.Debugf("VNC: X11 not available: %v", err)
log.Debugf("VNC: X11 input injection unavailable: %v", err)
// That failure covers two different things: no display at all, and a
// display whose server has no XTest extension. Only the first rules X11
// out. A host with a screen worth streaming and no way to inject input is
// still better served by a view-only X11 session than by falling through
// to a framebuffer console that is blank while X owns the VT.
probe, capErr := vncserver.NewX11Capturer("", "")
if capErr == nil {
probe.Close()
log.Infof("VNC: X11 capture available without input injection, serving view-only")
return vncserver.NewX11Poller("", ""), &vncserver.StubInputInjector{}, true
}
log.Debugf("VNC: X11 capture unavailable: %v", capErr)
// Fallback for headless / pre-X states (kernel console, login manager
// without X, physical server in recovery): stream the framebuffer and