Skip to content

feat(linux): add Undo/Cut/Copy/Paste keycodes - #120

Merged
ReenigneArcher merged 1 commit into
LizardByte:masterfrom
TinfoilSubmarine:undo_cut_copy_paste
Nov 9, 2026
Merged

ReenigneArcher merged 1 commit into
LizardByte:masterfrom
TinfoilSubmarine:undo_cut_copy_paste

Conversation

@TinfoilSubmarine

Copy link
Copy Markdown
Contributor

Description

Add Linux support for Undo/Cut/Copy/Paste keycodes (keyboard HID spec usage IDs 0x7A-0x7D). In order to do this I added some ad-hoc/bespoke keycodes. I'm unsure whether there is a better way to do this, especially something more platform-agnostic, but I only have Linux machines to test on here, so I limited scope to that.

Screenshot

Issues Fixed or Closed

Roadmap Issues

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
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

See our AI usage policy.

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@CLAassistant

CLAassistant commented Aug 31, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@TinfoilSubmarine TinfoilSubmarine changed the title add Undo/Cut/Copy/Paste keycodes for Linux feat: add Undo/Cut/Copy/Paste keycodes for Linux Aug 31, 2026

@ReenigneArcher ReenigneArcher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could these new semantic keycodes be added to libvirtualhid’s public API and documentation instead of existing only as numeric literals inside the Linux backend?

KeyboardKeyCode is currently documented as a Windows-style virtual-key code, but this change gives 0x0100–`

@sonarqubecloud

Copy link
Copy Markdown

@ReenigneArcher ReenigneArcher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The earlier request to expose and document the semantic keycodes is addressed. The named constants and Linux uinput/XTest mappings are sound for the stated Linux scope; I found no blocking defect in that behavior. I left one nonblocking clarification about backend support in the public documentation.

GitHub confirms conflicts with current master (7cd296c). Please rebase and resolve the conflicts before merging, preserving the intervening keyboard mappings, keyboard capability filtering, and backend changes. The editing-key mappings are still absent from current master, so this PR's feature remains useful.

Validation: 13 focused Ubuntu WSL gtest cases passed using the exact PR mapping and emission functions with recorded uinput/XTest calls; two MSYS2 UCRT64 recorder probes verified the Windows fallback behavior. The three changed files passed the repository clang-format check. This does not establish a full project build, real Linux-device/X-server behavior, or native macOS validation. CI, CodeQL, and lint await maintainer approval; the GH-Pages documentation check timed out waiting for those jobs.

Review completed by Codex | Model: gpt-6.1-sol | Thinking: xhigh

Comment thread src/include/libvirtualhid/types.hpp Resolved
@TinfoilSubmarine

Copy link
Copy Markdown
Contributor Author

Applied the suggested wording to the keyboard_key_codes docs. Rebased onto current master; the only conflict was the two Linux key-table sizes, which are now 52 (uinput) and 50 (XTest).

Expose the Undo/Cut/Copy/Paste editing keys as named semantic keycodes in
the public API (lvh::keyboard_key_codes) with documentation, since they
have no Windows virtual-key equivalent, and map them to the native Linux
evdev keys and X11 keysyms in the backend.
@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.18%. Comparing base (86b6f49) to head (1b1fdcb).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #120   +/-   ##
=======================================
  Coverage   73.18%   73.18%           
=======================================
  Files          44       44           
  Lines        9810     9810           
  Branches     3651     3651           
=======================================
  Hits         7179     7179           
  Misses       2254     2254           
  Partials      377      377           
Flag Coverage Δ
FreeBSD 53.99% <ø> (ø)
Linux-Clang 68.59% <ø> (ø)
Linux-GCC 80.55% <ø> (ø)
PowerShell 75.60% <ø> (ø)
Windows-MSVC 73.49% <ø> (ø)
Windows-MinGW-UCRT64 66.20% <ø> (ø)
macOS 50.94% <ø> (ø)

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 97.43% <ø> (ø)
src/platform/linux/uhid_backend.cpp 80.91% <ø> (ø)

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 86b6f49...1b1fdcb. Read the comment docs.

@ReenigneArcher ReenigneArcher changed the title feat: add Undo/Cut/Copy/Paste keycodes for Linux feat(linux): add Undo/Cut/Copy/Paste keycodes Nov 9, 2026
@ReenigneArcher
ReenigneArcher merged commit be43bef into LizardByte:master Nov 9, 2026
36 checks passed
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.

3 participants