feat(input): implement libvirtualhid#5368
Conversation
Bundle ReportChanges will increase total bundle size by 1.31kB (0.05%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: sunshine-esmAssets Changed:
|
92ddf06 to
d696dca
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #5368 +/- ##
==========================================
+ Coverage 27.18% 27.57% +0.38%
==========================================
Files 111 105 -6
Lines 25412 25096 -316
Branches 11214 11108 -106
==========================================
+ Hits 6909 6920 +11
- Misses 16570 17230 +660
+ Partials 1933 946 -987
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 34 files with indirect coverage changes Continue to review full report in Codecov by Harness.
|
b09b74e to
c8d6008
Compare
e4bd1df to
8f94bc8
Compare
Replace the ViGEmBus install/status flow with a unified virtual input driver status endpoint and UI. Update Windows packaging, docs, locale strings, and troubleshooting pages to reflect libvirtualhid as the primary backend, with ViGEmBus shown only as a fallback. Add unit coverage for driver version parsing and status JSON helpers.
Replace Windows-native synthetic pointer/keyboard input implementations with libvirtualhid equivalents: - Remove keylayout.h and its VK-to-scancode mapping (now handled by libvirtualhid) - Remove Windows-specific touch/pen device management (HSYNTHETICPOINTERDEVICE, repeat tasks, slot compaction) - Pass touch_port and flags through to libvirtualhid for keyboard, touch, and pen events - Add pointer_viewport() and keyboard_event() helpers in virtualhid_input.cpp - Differentiate LI_TOUCH_EVENT_UP, CANCEL, and HOVER_LEAVE handling for touch contacts - Add PointerTransition support for pen events - Update capability detection to use libvirtualhid runtime - Update libvirtualhid submodule to c1cc7e0
Replace the macOS input implementation with a libvirtualhid-backed backend and route mouse, keyboard, scroll, touch/pen, and gamepad paths through shared virtualhid contexts. Update macOS CMake wiring to build/link libvirtualhid and include the new shared virtualhid input sources, and bump the libvirtualhid submodule to the required revision.
Move libvirtualhid integration from Linux/macOS/Windows compile definition files into common.cmake. This removes duplicated target/library/source wiring, keeps Linux-specific libevdev override variables set before inclusion, and preserves the libevdev -> libvirtualhid build dependency when using the ExternalProject fallback.
Refactor absolute mouse test to use platform-aware touch port helper and account for display origin offsets when verifying expected mouse position. Removes the incorrect `has_input_moved` assertion and updates libvirtualhid submodule.
Implement get_mouse_loc using GetCursorPos on Windows and XQueryPointer on Linux/X11. Remove the GTEST_SKIP for Windows and Linux virtual mouse tests. Replace fixed sleep with polling loop to wait for mouse movement, fix absolute mouse port to use virtual screen metrics on Windows, and relax movement assertions to direction-only checks to account for OS pointer acceleration.
8f94bc8 to
4a64041
Compare
Change `get_mouse_loc()` to return `std::optional<util::point_t>` instead of a sentinel value, properly indicating when the mouse location cannot be observed on a platform. Update all platform implementations (Linux, macOS, Windows) and tests to handle the optional return type. Add libxtst-dev dependency to Linux CI workflow.
4a64041 to
ed17e4f
Compare
|
| constexpr auto CSRF_TOKEN_LIFETIME = std::chrono::hours(1); // Tokens valid for 1 hour | ||
|
|
||
| constexpr auto LIBVIRTUALHID_MINIMUM_VERSION = ""sv; ///< Minimum supported libvirtualhid driver version; empty means any version. | ||
| constexpr auto VIGEMBUS_MINIMUM_VERSION = "1.17.0.0"sv; ///< Minimum supported ViGEmBus fallback driver version. |
|
|
||
| // Test: driver status JSON includes compatibility and supported version metadata | ||
| TEST(ConfigHttpDriverStatusTest, BuildDriverStatus_IncludesExpectedFields) { | ||
| const auto status = confighttp::build_driver_status(true, "1.17.0.0", "1.17.0.0"); |
|
|
||
| // Test: driver status JSON includes compatibility and supported version metadata | ||
| TEST(ConfigHttpDriverStatusTest, BuildDriverStatus_IncludesExpectedFields) { | ||
| const auto status = confighttp::build_driver_status(true, "1.17.0.0", "1.17.0.0"); |




Description
This PR implements libvirtualhid in Sunshine, replacing inputtino on Linux, vigembus on Windows AMD64, and moves the mouse/keyboard input for macOS as well.
We will still falling back to vigembus on Windows ARM64 or in cases where the user doesn't have libvirtualhid's driver installed.
TODO:
Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage