Fix modifier keys being instantly released when clients send side-specific VK codes - #459
Open
LorenzoMorelli wants to merge 1 commit into
Open
Fix modifier keys being instantly released when clients send side-specific VK codes#459LorenzoMorelli wants to merge 1 commit into
LorenzoMorelli wants to merge 1 commit into
Conversation
|
Confirming this fixes the issue I reported in games-on-whales/gow#299 — I was seeing the same symptom (Shift/Ctrl registering fine for menus/binding but not during actual gameplay) with a Wine + DirectInput game (DDO), not just Minecraft/LWJGL. Tested with this fix applied and modifier keys now hold correctly during play. Thanks for tracking down the side-specific VK code issue. |
ABeltramo
requested changes
Aug 8, 2026
ABeltramo
left a comment
Member
There was a problem hiding this comment.
Thanks for contributing and sorry it took me this long to review. I think the fix is good and valid, I'd just like for it to be implemented differently so that it's more idiomatic with our codebase.
Refactored to match Wolf's codebase style: track held modifiers as a per-session immer::atom<char> on StreamSession instead of global state.
Author
|
Hi and thanks for reviewing! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
keyboard_key()synthesizes "virtual modifiers" around everyKEY_PRESS: it presses the modifiers reported in the packet flags, presses the actual key, then immediately releases those modifiers. The guards that skip this dance when the pressed key is the modifier itself only compare against the generic Windows VK codes (M_SHIFT = 0x10,M_CTRL = 0x11), but clients (e.g. moonlight-qt) send the side-specific codes (VK_LSHIFT = 0xA0,VK_LCONTROL = 0xA2, ...).As a result:
Typical symptoms: hold-modifier actions in games don't work (e.g. Shift to sprint) and key-binding screens don't detect Shift/Ctrl, while text capitalization keeps working (the modifier state bit is briefly set around each letter). Alt is unaffected only by luck, since
M_ALThappens to be defined as the side-specific code (0xA4). This is likely the root cause of games-on-whales/gow#299.Fix
MOONLIGHT_MODIFIERSand recognize both families through amodifier_bit()helper.Note: the bug can go unnoticed on sessions using uinput virtual devices, because inputtino periodically re-presses the keys it still tracks as held (
cur_press_keys), so the wrongly released modifier comes back down after a few milliseconds. Sessions using the Wayland virtual keyboard have no such keep-alive, so the modifier stays released.