Uh oh!
There was an error while loading. Please reload this page.
Potentially fix #1269 - #1282
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a WinForms-to-WPF input bridge so editor hotkeys (e.g., Undo/Redo) still work when focus is inside WPF-hosted UI (notably the flyby timeline) while the main window remains WinForms.
Changes:
- Added
WpfEditorShortcutBridgeto listen to WPFInputManagerkey-down events and forward recognized editor hotkeys toCommandHandler. - Wired the bridge into
FormMainlifecycle (create on startup, dispose on form disposal).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| TombEditor/WpfEditorShortcutBridge.cs | New WPF PostProcessInput handler that maps WPF key events to WinForms Keys and executes matching editor hotkeys. |
| TombEditor/Forms/FormMain.cs | Instantiates and disposes the shortcut bridge as part of the main form lifecycle. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
TombEditor/WpfEditorShortcutBridge.cs:61
- This path scans UI_Hotkeys twice: first via Any(...Contains(keyData)) and then again inside CommandHandler.ExecuteHotkey (which also does a Where(...Contains)). Since this runs on every WPF KeyDown while the form is focused, consider changing the hotkey execution API to return whether it executed anything (or otherwise avoid the second scan) so you can decide whether to set Handled without re-enumerating the whole hotkey table.
if (keyEventArgs.Handled ||
WinFormsUtils.DirectionalCameraKeys.Contains(keyData) ||
WinFormsUtils.CurrentControlSupportsInput(_form, keyData) ||
!_editor.Configuration.UI_Hotkeys.Any(set => set.Value.Contains(keyData)))
return;
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
TombEditor/WpfEditorShortcutBridge.cs:33
- OnPostProcessInput filters to only Keyboard.KeyDownEvent. In WPF, some controls/command bindings handle input during PreviewKeyDown (and may suppress the subsequent KeyDown), which would make this bridge miss the keystroke and fail to dispatch the editor hotkey in exactly the scenarios it is meant to fix (e.g., Ctrl+Z/Ctrl+Y when a WPF control is focused). Consider allowing both KeyDown and PreviewKeyDown routed events (or dropping the RoutedEvent filter entirely) so the bridge sees the key regardless of where WPF handles it in the pipeline.
if (e.StagingItem.Input is not System.Windows.Input.KeyEventArgs keyEventArgs ||
keyEventArgs.RoutedEvent != Keyboard.KeyDownEvent ||
!_form.ContainsFocus)
return;
NOT TESTED! Please verify if this fixed the issue and make sure all expected FlyBy Timeline keyboard shortcuts still work.