Skip to content

fix(linux): target absolute input at the captured monitor - #6055

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

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

On KDE Wayland, streaming DP-1 can leave native touch and pen input assigned to HDMI-A-1. Forward the captured connector name through the Linux capture and input pipelines so libvirtualhid can assign its virtual devices to the streamed output. Preserve negative desktop origins and exclude client letterboxing when normalizing touch/pen coordinates.

This draft depends on LizardByte/libvirtualhid#221. The submodule currently points to its 86da2c2 branch commit; update the gitlink to the merged library commit before marking this PR ready. Automatic device assignment is specific to KDE Wayland; other compositors retain their existing device mapping.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

Validated locally in a Fedora Linux container with a virtual X display and null audio sink; CUDA, Vulkan, and tray support were disabled:

cmake --build cmake-build-linux-input-monitor --target sunshine test_sunshine -j 3
DISPLAY=:99 XDG_RUNTIME_DIR=/tmp/sunshine-runtime cmake-build-linux-input-monitor/tests/test_sunshine
uv run --locked lb-update-clang-format
  • The production executable and test executable built successfully, including KMS, Wayland, KWin, and portal capture paths.
  • The full suite ran 900 tests: 895 passed and five platform/hardware tests skipped.
  • Regression tests cover monitor retargeting, connector metadata, negative origins, mixed scaling, letterboxing, unavailable desktop geometry, and invalid visible dimensions. Touch/pen coordinates remain local to the streamed monitor.
  • The unoptimized geometry regression object reached 100% line, function, and branch coverage. Formatting and diff checks passed.

Real multi-monitor KDE/uinput behavior and native Windows/macOS Sunshine builds were not validated locally. Plasma 6.5.1 or later is recommended for reliable runtime device reassignment.

The strict Dockle/Doxygen 1.18.0 documentation build passes locally after rebasing onto master (774be88e; 1,131 themed HTML pages). The Read the Docs failure in build 35684696 was caused by duplicate make_port() parameter documentation in its declaration and definition; the complete documentation is now kept on the header declaration. Read the Docs build 35685331 passed for the pre-rebase 4b653262 commit.

After the Sonar refactors, the input regression source passed native Clang syntax validation, and formatting/diff checks passed. The final dependency pin includes the unavailable-then-available capability regression and confirmed-assignment caching fix from libvirtualhid. The latest full Linux build/test matrix remains in hosted CI.

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.

@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

Forward the streamed connector to libvirtualhid for KDE Wayland touch and pen assignment. Preserve negative desktop origins across capture backends and exclude client letterboxing from native pointer normalization.

Pin the preceding libvirtualhid output-mapping fix and cover desktop geometry, monitor retargeting, and normalized input with regression tests.
Keep make_port documentation on its header declaration so strict Doxygen builds do not merge duplicate parameter blocks. Refresh the libvirtualhid pin to its preceding Sonar cleanup.
Use scoped initialization and const framebuffer metadata in KMS helpers, make the capture callback generic, and force expression parsing for the test dispatch call. Pin libvirtualhid's final fixture and complexity cleanup.
@ReenigneArcher
ReenigneArcher force-pushed the codex/fix-linux-input-monitor branch from 4b65326 to 1bb695d Compare November 6, 2026 00:23
@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 55.81395% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.02%. Comparing base (774be88) to head (1bb695d).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/linux/kmsgrab.cpp 9.09% 17 Missing and 3 partials ⚠️
src/platform/linux/pipewire.cpp 0.00% 10 Missing and 1 partial ⚠️
src/platform/linux/wlgrab.cpp 0.00% 5 Missing ⚠️
src/platform/linux/kwingrab.cpp 0.00% 1 Missing ⚠️
src/platform/linux/portalgrab.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6055      +/-   ##
==========================================
+ Coverage   47.64%   49.02%   +1.38%     
==========================================
  Files         140      143       +3     
  Lines       30896    31264     +368     
  Branches    13058    13383     +325     
==========================================
+ Hits        14720    15327     +607     
+ Misses      14776    13846     -930     
- Partials     1400     2091     +691     
Flag Coverage Δ
Alpine-aarch64 33.76% <42.50%> (+0.72%) ⬆️
Alpine-x86_64 33.89% <42.50%> (+0.72%) ⬆️
Archlinux 33.26% <37.50%> (+0.30%) ⬆️
FreeBSD-amd64 33.57% <70.96%> (+0.68%) ⬆️
Homebrew-macos-15 48.98% <100.00%> (+1.08%) ⬆️
Homebrew-macos-26 49.38% <100.00%> (+1.08%) ⬆️
Homebrew-ubuntu-24.04 35.72% <17.50%> (+0.64%) ⬆️
Linux-AppImage-aarch64 38.38% <51.25%> (+0.79%) ⬆️
Linux-AppImage-x86_64 38.62% <51.25%> (+0.78%) ⬆️
PowerShell 100.00% <ø> (ø)
Web-UI 56.65% <ø> (ø)
Windows-AMD64 40.15% <96.66%> (?)
Windows-ARM64 34.11% <100.00%> (+0.28%) ⬆️
macOS-arm64 41.37% <100.00%> (+0.92%) ⬆️
macOS-x86_64 40.91% <100.00%> (?)

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

Files with missing lines Coverage Δ
src/input.cpp 75.95% <100.00%> (+6.44%) ⬆️
src/input.h 66.66% <ø> (-33.34%) ⬇️
src/platform/common.h 74.66% <100.00%> (+1.51%) ⬆️
src/platform/linux/display_geometry.h 100.00% <100.00%> (ø)
src/platform/virtualhid_input.cpp 97.99% <100.00%> (+<0.01%) ⬆️
src/video.cpp 57.85% <100.00%> (+2.44%) ⬆️
src/video.h 68.70% <ø> (ø)
src/platform/linux/kwingrab.cpp 0.00% <0.00%> (ø)
src/platform/linux/portalgrab.cpp 4.44% <0.00%> (-0.01%) ⬇️
src/platform/linux/wlgrab.cpp 29.28% <0.00%> (+0.61%) ⬆️
... and 2 more

... and 43 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 774be88...1bb695d. Read the comment docs.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Last Updated 2026-11-06 01:24:34 UTC
Source Run CI Run #6591
Commit 1bb695d4c73b85d332867d3595eb0254f7d3921d

Screenshot Comparison

PR #6055 screenshots vs screenshots baseline.

Matrix: AppImage-aarch64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: AppImage-x86_64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-AMD64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-ARM64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-arm64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-x86_64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

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.

Mouse/Stylus/Touch input is in wrong monitor when using multi-monitor on Linux

1 participant