Repository navigation
Move the frame dump and GPU capture hotkey to Ctrl+Shift+P - #1076
Merged
Merged
Conversation
Ctrl+Shift+F7 never reaches Wine. With Wine's +key trace, Fn+F7 alone arrives as press 98 (kVK_F7), but with Control and Shift held Wine receives only the Shift (56) and Control (59) presses and no F7, and Ctrl+Shift+F6 likewise delivers nothing. macOS takes Ctrl+F1 to Ctrl+F8 for keyboard navigation even with Shift held, the Metal HUD's menu takes Shift+F8 to Shift+F12 and Ctrl+Shift+F9 to Ctrl+Shift+F12, and Steam takes a bare F12, so no Ctrl+Shift function-key chord is free. The hotkey is now P going down while Control and Shift are held and Alt (which winemac maps from Command) is up, with the same edge semantics: a held chord fires once, modifiers pressed after the key never fire, and the modifiers are read only on the sample where the key goes down. P sits at the same place on QWERTY, QWERTZ and AZERTY, so VK_P (0x50) does not move with the layout, and it needs no Fn. The unit tests check that Ctrl+Shift+P fires once per press and that P, Shift+P, Ctrl+P, Ctrl+Alt+Shift+P, F12, Ctrl+Shift+F12, the old Ctrl+Shift+F7, the HUD's Shift+F8 to F12 and Ctrl+Shift+F9 to F12, and Ctrl+F1 to F8 with or without Shift do not. Every doc and comment that named Ctrl+Shift+F7 now names Ctrl+Shift+P, and the README and the architecture notes give the new reason and drop the MacBook Fn note.
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.
Symptoms
Ctrl+Shift+F7 (#1075) does not arm the frame dump and GPU capture, because the key never reaches Wine. A game run with Wine's
+keytrace shows Fn+F7 alone arriving aspress 98(kVK_F7), but with Control and Shift held Wine receives only the Shift (56) and Control (59) presses and no F7. Ctrl+Shift+F6 delivers nothing either.macOS takes Ctrl+F1 to Ctrl+F8 for its keyboard-navigation shortcuts and still takes them with Shift held. The Metal HUD's menu takes Shift+F8 to Shift+F12 and Ctrl+Shift+F9 to Ctrl+Shift+F12, and Steam takes a bare F12. So no Ctrl+Shift function-key chord reaches the game.
Changes
The hotkey is now a fixed Ctrl+Shift+P: P going down while Control and Shift are held and Alt is up (winemac reports either Command key as Alt). The edge semantics are unchanged: a held chord fires once, Control and Shift pressed after P is already down never fire, and the modifiers are read only on the present where P goes down.
CAPTURE_KEYinwindows/core/src/capture_chord.rsbecomesVK_P(0x50);windows/d3d9/src/capture.rsalready reads it from there, so only its comments change.P sits at the same place on QWERTY, QWERTZ and AZERTY, so its virtual-key code does not move with the keyboard layout, and as a letter it needs no Fn on a MacBook keyboard. macOS, the Metal HUD and Steam do not use it, and games that bind P rarely bind Ctrl+Shift+P.
The unit tests in
capture_chord/tests.rscheck that Ctrl+Shift+P fires once per press and not while held, and that P, Shift+P, Ctrl+P and Ctrl+Alt+Shift+P do not. They also check that the chords that never reach Wine do not fire: F12, Ctrl+Shift+F12, the old Ctrl+Shift+F7, the HUD's Shift+F8 to F12 and Ctrl+Shift+F9 to F12, and Ctrl+F1 to F8 with or without Shift. The tests for modifiers pressed after the key and for reading modifiers only on the press are kept.Every doc and comment that named Ctrl+Shift+F7 now names Ctrl+Shift+P: the README,
docs/ARCHITECTURE.md(section heading and its anchor), the link to it indocs/GAMES.md,CONTRIBUTING.md, thebench-shapetext in the Makefile,mtld3d.conf, the bench runner's messages and the code comments on both sides. The README and the architecture section give the new reason (Steam's F12, the HUD's Shift+F8 to F12 and Ctrl+Shift+F9 to F12, and macOS's Ctrl+F1 to F8, which it takes even with Shift held), say that P sits at the same place on the common layouts, keep the Control-not-Command note, and drop the MacBook Fn note.Alternatives considered
Another function key: Ctrl+F1 to F8 belong to macOS with or without Shift, Ctrl+Shift+F9 to F12 to the HUD, and F12 to Steam, so every Ctrl+Shift function-key chord is taken before Wine sees it. A different letter: a letter that moves between QWERTY, QWERTZ and AZERTY (such as Y, Z, A, Q or M) would put the chord on a different key position, or a different virtual-key code, depending on the layout, while P does not move. A configurable key was not added: the chord stays fixed, with no config key and no environment variable.
Verification
make fmt,make check(rustfmt, clippy with nursery and pedantic on both workspaces and the PE targets,make audit,make doc) andmake test-unitran green: 1972 windows-workspace tests, including the 14capture_chordtests, and 755 unix-workspace tests passed. No end-to-end test uses the hotkey, somake testwas not run.The reason for the change comes from the
+keytrace above: Fn+F7 alone reaches Wine aspress 98, Ctrl+Shift+F7 and Ctrl+Shift+F6 deliver only the modifier presses. Ctrl+Shift+P was pressed in World of Warcraft 1.12 with Wine's+keytrace on, and Wine receivedpress 59(Control),press 56(Shift) andpress 35(kVK_ANSI_P) with modifiers 0x00060103, so P arrives with Control and Shift held. The build installed for that run predates this change, so the dump itself has not fired from the new chord yet; a reviewer can check it by pressing Ctrl+Shift+P in a game started withMTL_CAPTURE_ENABLED=1and looking for the[dump]lines and a<exe>-<pid>-<n>.gputracebeside the log.Rules check
The change adds no static, config key, environment variable, wire field, dependency, derive or lint suppression, and duplicates nothing: it changes the value of the existing
CAPTURE_KEYinmtld3d-coreand the existing per-poll latch keeps its doc-block argument. The tests stay incapture_chord/tests.rs(Unit tests live in<stem>/tests.rs), and doc blocks keep the title, blank, body shape.make checkenforces these through clippy,make auditandmake doc, and it ran green.