Skip to content

Use EVDEV as the default input source. - #180

Open
kwhat wants to merge 14 commits into
1.3from
evdev
Open

Use EVDEV as the default input source.#180
kwhat wants to merge 14 commits into
1.3from
evdev

Conversation

@kwhat

@kwhat kwhat commented Nov 25, 2023

Copy link
Copy Markdown
Owner

No description provided.

kwhat added 5 commits July 27, 2026 06:48
Replace one-shot glob enumeration with a libudev enumerate + netlink
monitor so devices are hooked and released as they are plugged in and
out.  Classify devices from udev ID_INPUT_* properties, and skip our own
uinput clones so grabbing a clone cannot cascade into an infinite loop.

Add eventfd-based hook_stop() to break the epoll loop cleanly, and move
pointer position into self-tracking (track_pointer_delta) so mouse_move
no longer needs X11 for every relative event.

Restructure the event handling: hook_event_proc becomes a flat EV_* type
router delegating to hook_key_proc / hook_rel_proc / hook_sync_proc, the
per-device drain and cleanup move into hook_device_proc and an idempotent
hook_teardown, and every dispatch_* function now takes the raw input_event
and derives its own timestamp, keycode and keysym for a consistent layer.
kwhat added 6 commits July 27, 2026 06:48
Make X11 a runtime (dlopen) dependency instead of a link-time one, and
add Wayland-native paths wherever a protocol exists, so libuiohook.so
builds and starts with no X11/Wayland NEEDED entries and works on pure
Wayland, X11, or a bare console.

- x11_helper: dlopens libX11 / libX11-xcb / libxkbcommon-x11 / libXinerama
  into a resolved function-pointer struct owning one shared Display.
- wayland_helper: dlopens libwayland-client (functions via dlsym, the
  wl_*_interface data symbols compiled in from wayland-scanner output for
  core, xdg-output, xdg-shell and the vendored wlr-layer-shell protocol).
- Keymap now comes from wl_keyboard.keymap (Wayland) then xkb_x11 (X) then
  a default layout; key repeat from wl_keyboard.repeat_info; keysym->keycode
  is pure libxkbcommon; screen layout from xdg-output; and the pointer
  position seed from a transparent zwlr_layer_shell_v1 overlay probe.
  Every path is Wayland-first (XWayland reports the wrong view), falling
  back to X, then a default.
- hook_post_event reimplemented on a lazily created uinput device (no X).
- Drop the libXt dependency (multi-click time via XGetDefault + default).
- Normalize reinjected REL motion by the device MOUSE_DPI so a grabbed
  high-DPI mouse does not feel over-accelerated under Wayland; the uinput
  clone carries no MOUSE_DPI for libinput to normalize.
Align the CI workflow and README with the backend's actual dependencies:
add libevdev, libudev, libwayland (+ wayland-scanner) and wayland-protocols,
and drop the no-longer-used libXtst, libXt and libxkbfile.  In the cross
jobs the wayland-scanner build tool and wayland-protocols data are host /
arch-independent, so they install without a target arch suffix.

Also drop the removed USE_XT option from the README configuration table.
- wayland_helper: replace memfd_create with POSIX shm_open so the file no
  longer depends on _GNU_SOURCE; link librt for shm_open on older glibc.
- dispatch_event: make dispatch_event() static; fix mouse wheel rotation to
  delta * rotation; gate the synthesized CLICKED event on the release consume
  flag to match the other backends; take the resolved uiohook button as a
  parameter instead of translating and returning a mask out-param.
- input_hook: map BTN_* to button + mask inline in hook_key_proc (matching the
  Windows/Darwin backends); fix the horizontal wheel dispatching the vertical
  delta; accumulate the consumed flag across the motion/wheel flushes.
- input_helper: guard keycode_to_utf8 against multi-codepoint overrun and guard
  the per-event paths against a NULL xkb state; drop the X11 pointer-map lookup
  (button_map_lookup) and its button table -- raw evdev buttons are not remapped
  through the X server.
- system_properties: fix the multi-click sscanf check (== 1, not != EOF); remove
  the dead XRandR settings thread and the broken XF86Misc fallback; resolve the
  X display via x11_display() instead of a cached static.
- x11_helper: drop the now-unused XGetPointerMapping binding.
- CMakeLists: drop the USE_XF86MISC/USE_XRANDR/USE_XINERAMA options (Xinerama is
  loaded at runtime unconditionally) and require the Xinerama headers alongside
  the other X11 headers.

Add FIXME.md tracking the deferred evdev motion/wheel consumption fix.
- dispatch_event: clamp the scaled wheel rotation to the int16_t field, pinning
  to INT16_MAX/INT16_MIN with an overflow/underflow warning instead of wrapping.
- wayland_helper: null-check wl_registry_bind for the seat/output globals; check
  wl_display_roundtrip returns in the enumeration and keymap paths; serialize the
  one-time dlopen + symbol resolution with a mutex; replace the WL_LOAD macro with
  a wl_resolve() function driven by a symbol table; clamp the probed pointer
  position to the int16_t coordinate range with a warning rather than wrapping.
- x11_helper: drop the unused xkb_x11_state_new_from_device binding (X11_CAP_XKB
  no longer requires it); replace the RESOLVE macro with an x11_resolve() function.
kwhat added 2 commits July 27, 2026 07:28
The public uiohook_event.reserved field was removed in 1.3; consumption is
now signalled via MASK_CONSUMED in the event mask (matching the x11/windows/
darwin backends).  Drop the reserved writes and read consumption from
uio_event.mask & MASK_CONSUMED so the evdev backend builds against 1.3.
linux-arm was the only cross job enabling ubuntu-toolchain-r/test.  It upgrades
libgcc-s1:amd64 ahead of the armhf ports version, and libgcc-s1 must be the same
version across architectures, so libc6:armhf / libffi8:armhf could not resolve
(held broken packages).  The distro gcc-arm-linux-gnueabihf provides the cross
compiler, so the PPA is not needed here; disabling it matches the other cross jobs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant