Weylus is a cross-platform application that turns tablets and smartphones into graphic tablets/touch screens for computers. It operates by running a local web server that serves a web page to the tablet's browser. The web page captures pointer, touch, stylus, keyboard, and wheel events via JavaScript PointerEvents and sends them over a WebSocket connection to the server. The server then simulates these input events on the host machine using platform-specific mechanisms: on Linux it uses the uinput kernel module for full stylus/touch/mouse/keyboard support; on macOS and Windows it falls back to the autopilot library for mouse/keyboard simulation and Windows-specific synthetic pointer injection for touch/pen. Simultaneously, Weylus captures the screen (or a selected window/monitor) using platform-native APIs: X11 shared memory (XShm) on Linux X11, PipeWire/GStreamer on Wayland, CoreGraphics on macOS, and DirectX via captrs on Windows. The captured frames are encoded into a fragmented MP4 H.264 video stream using a statically linked ffmpeg (libx264) with optional hardware acceleration (VAAPI, NVENC, VideoToolbox, MediaFoundation). The video stream is sent to the browser via the same WebSocket connection and played using the Media Source Extensions API. The application provides a GUI (built with FLTK) for configuration and a headless mode for automation. It supports access codes, custom input areas, and multiple simultaneous clients.
Hammer.js is a JavaScript library for detecting touch gestures in web applications. It provides a modular architecture with a Manager class that coordinates input handling (touch, mouse, pointer events) and gesture recognition (tap, double tap, press, pan, swipe, pinch, rotate). The library normalizes different input types into a consistent gesture recognition system, manages gesture lifecycle states, and handles touch-action CSS property polyfilling. It features an event-driven architecture where recognizers emit events when gestures are detected, which are forwarded to registered listeners. The library has no runtime dependencies, relying solely on standard web APIs.