Skip to content

fix(linux): map virtual touch and pen devices to streamed outputs - #221

Open
ReenigneArcher wants to merge 4 commits into
masterfrom
codex/fix-linux-input-monitor
Open

ReenigneArcher wants to merge 4 commits into
masterfrom
codex/fix-linux-input-monitor

Conversation

@ReenigneArcher

@ReenigneArcher ReenigneArcher commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Description

Linux compositors can keep virtual touchscreens and pen tablets assigned to the default monitor even when the application streams another display. Add an optional PointerViewport::output_name hint and map the library-owned event node to that connector through KWin's session D-Bus API. Pen assignment also disables workspace-wide mapping.

Only confirmed assignments are cached. Unavailable capability probes are retried on later events, device-registration races receive bounded retries, and failed assignments stop input submission. GIO support is optional; other compositors retain their existing mapping. Plasma 6.5.1 or later is recommended for reliable output reassignment.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

Validated locally on Linux in a Fedora container:

cmake --build cmake-build-linux-input-monitor --target test_libvirtualhid
cmake-build-linux-input-monitor/tests/test_libvirtualhid --gtest_filter='-LinuxConsumerTest.*:LinuxRuntimeTest.LinuxUhidSmokeTestRequiresPrerequisites:LinuxRuntimeTest.LinuxUinputSmokeTestRequiresPrerequisites'
  • All 161 device-independent tests passed, including 15 new mapping tests. The regressions assert output selection, retargeting, owned-device isolation, unchanged normalized coordinates, registration retries, and no input after a mapping error.
  • The mapping helper reached 100% branch and function coverage.
  • Linux library/examples builds passed with output mapping enabled and disabled; the macOS library/examples build and CMake package installation passed.
  • CMake lint, clang-format, and diff checks passed.

The container lacks /dev/uinput, /dev/uhid, and a real KDE session. The 21 installed-device tests were excluded; physical multi-monitor touch/pen behavior remains unverified.

Current-head validation: all 13 portable D-Bus mapping tests passed natively, including a new unavailable-then-available KWin capability regression that failed before the cache fix. The mapping helper reached 100% line, function, and branch coverage. The GIO-disabled source syntax check and strict Dockle/Doxygen 1.18.0 documentation build passed (167 themed HTML pages); Read the Docs build 35685315 also passed for 86da2c2. The macOS library/examples build passed after the Sonar refactor. Linux uinput cases on the latest changes await hosted CI; the earlier 161-test Linux run is recorded above.

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR

Codex assisted with investigation, implementation, regression tests, documentation, and this PR description.

This pull request was generated by Codex, GPT-6.1 Sol, extra high thinking level.

Copy link
Copy Markdown
Member Author

This pull request was generated by Codex, GPT-6.1 Sol, extra high thinking level.

Keep fixture state private behind explicit controls and isolate optional touchscreen assignment from contact emission to satisfy the remaining Sonar findings.
@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.32%. Comparing base (4847ea0) to head (86da2c2).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #221      +/-   ##
==========================================
+ Coverage   73.17%   73.32%   +0.15%     
==========================================
  Files          44       45       +1     
  Lines        9810     9865      +55     
  Branches     3651     3692      +41     
==========================================
+ Hits         7178     7234      +56     
- Misses       2026     2197     +171     
+ Partials      606      434     -172     
Flag Coverage Δ
FreeBSD 53.72% <5.55%> (-0.28%) ⬇️
Linux-Clang 68.49% <64.81%> (-0.10%) ⬇️
Linux-GCC 80.74% <100.00%> (+0.19%) ⬆️
PowerShell 75.60% <ø> (ø)
Windows-MSVC 73.47% <ø> (+0.14%) ⬆️
Windows-MinGW-UCRT64 66.28% <ø> (+0.01%) ⬆️
macOS 50.90% <100.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/include/libvirtualhid/types.hpp 96.61% <100.00%> (-0.83%) ⬇️
src/platform/linux/output_mapping.cpp 100.00% <100.00%> (ø)
src/platform/linux/uhid_backend.cpp 81.04% <100.00%> (+0.12%) ⬆️

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4847ea0...86da2c2. Read the comment docs.

This branch has not been deployed

No deployments
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.

2 participants