Add gamepad calibration visualization and reset functionality#15
Merged
Conversation
- 新增 GamepadCalibrationDialog 即時診斷視窗,以 30fps 顯示雙搖桿(LS/RS) 的原始輸入點(空心菱形)、校正後位置(藍點)、死區進入閾值(實線環) 與死區離開閾值(虛線環),兩環間的遲滯區防止邊界抖動 - 新增 GamepadCalibrationSnapshot record 封裝單次快照資料 - 新增 GamepadCalibrationVisualizerMapper 負責死區半徑計算與畫布座標轉換 - 擴充 IGamepadController 介面新增 GetCalibrationSnapshot() 與 ResetCalibration() - XInputGamepadController 與 GameInputGamepadController 實作 EMA 偏移學習、 D-Pad 防污染暫停機制與 ResetCalibration() 清除執行期偏移值 - 從右鍵選單「遊戲控制器調校」子選單整合「校正狀態視覺化…」開啟入口 及「重設目前校正狀態」功能(含震動回饋) - 補齊 7 語系(EN、zh-Hant、zh-Hans、de、fr、ja、ko)的視覺化相關在地化字串 - 新增 GamepadCalibrationVisualizerMapperTests(9 個測試)並同步更新 介面測試替身以符合擴充後的 IGamepadController 簽章 - 更新 README.md 補充校正狀態視覺化的四元素判讀說明
- 統一對話框 DPI 與字型更新流程。 - 為設定切換加入震動回饋與迴歸測試。 - 補充 README 與 XML 文件註解並清除建置警告。
- HandleSurfacePaint: compute float s = DeviceDpi / AppSettings.BaseDpi; scale all Pen widths by s (outerPen 2x2s, crossPen 1x1.5s, deadzonePen 2x2.5s, deadzoneExitPen 1.5x2s, rawPen 2x2.5s, correctedOutlinePen 1.5x2s) so strokes remain visible and proportional on high-DPI displays. - Deadzone fill alpha raised 22 to 48 (HighContrast 36 to 60); raw-dot alpha raised 40 to 64 (HighContrast 80 to 100) so both rings are perceptible at 96 DPI and within accessible contrast limits on white backgrounds. - DrawStickPlot: all fixed-pixel marker geometry scaled by dpiScale; center dot radius 3 to 3s, raw diamond half-size 8 to 8s, corrected dot radius 6 to 6s. - ShouldHandleDirectionalFocusNavigation: fix LS-triggered focus-jump bug. ApplyStickToButtons maps LS to D-Pad bits when correctedLeftThumb crosses ThumbDeadzoneEnter (~0.24 normalised). The previous guard threshold was normalizedDeadzone+0.02 (~0.26), which is larger than the mapping threshold, so the guard incorrectly passed when LS just triggered the mapping. Changed to normalizedDeadzone*0.75 (clamped 0.06-0.18) so any LS position that activates stick-to-D-Pad mapping is already outside the guard range. - Add test ShouldHandleDirectionalFocusNavigation_WhenStickJustCrossesEnterDeadzone_ReturnsFalse covering the ThumbDeadzoneEnter=7849 edge case (LS at -0.24 must return false).
zh-Hant: 死區進入/離開 -> 死區進入/離開;數值分隔 {8}/{9} -> {8}/{9}
zh-Hans: 死区进入/离开 -> 死区进入/离开;數值分隔 {8}/{9} -> {8}/{9}
ja: デッドゾーン入/出 -> デッドゾーン入/出;數值分隔 {8}/{9} -> {8}/{9}
CJK 排版規範要求連接詞「/」使用全形 U+FF0F(/);
英文、德文、法文、韓文維持半形不變。
同步更新 Copilot、Gemini 與技能文件,明確要求 Agent 只能使用使用者既有的 GPG 設定。 禁止自行修改 gpg.conf、gpg-agent.conf 等設定檔,且簽章失敗時必須提醒使用者自行處理。
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a live gamepad calibration visualizer to InputBox, including controller-side snapshot plumbing to support diagnostics UI, plus UX/accessibility improvements, updated vibration semantics, and tightened documentation around GPG-signing compliance.
Changes:
- Introduces a new calibration visualizer dialog + mapper utilities, and exposes a live
CurrentCalibrationSnapshoton gamepad controllers for diagnostics. - Adds new vibration patterns for setting toggles and expands test coverage for the new semantics and calibration mapping/formatting helpers.
- Updates localized resources, README/docs, and engineering guidance for stricter GPG-signing compliance wording.
Reviewed changes
Copilot reviewed 35 out of 36 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/InputBox.Tests/VibrationPatternsTests.cs | Adds assertions for new setting-toggle vibration semantics; updates stubs for the new controller snapshot API. |
| tests/InputBox.Tests/README.md | Updates test inventory to include calibration visualizer mapper tests and adjusts totals. |
| tests/InputBox.Tests/PhraseManagerDialogGamepadTests.cs | Updates stub controller to implement CurrentCalibrationSnapshot. |
| tests/InputBox.Tests/GamepadMessageBoxTests.cs | Updates stub controller to implement CurrentCalibrationSnapshot. |
| tests/InputBox.Tests/GamepadEventBinderTests.cs | Updates stub controller to implement CurrentCalibrationSnapshot. |
| tests/InputBox.Tests/GamepadCalibrationVisualizerMapperTests.cs | Adds regression tests for mapper clamping/deadzone math and dialog formatting/navigation guards. |
| src/InputBox/Resources/Strings.zh-Hant.resx | Adds menu/dialog/a11y strings for the calibration visualizer (Traditional Chinese). |
| src/InputBox/Resources/Strings.zh-Hans.resx | Adds menu/dialog/a11y strings for the calibration visualizer (Simplified Chinese). |
| src/InputBox/Resources/Strings.resx | Adds menu/dialog/a11y strings for the calibration visualizer (English). |
| src/InputBox/Resources/Strings.ko.resx | Adds menu/dialog/a11y strings for the calibration visualizer (Korean). |
| src/InputBox/Resources/Strings.ja.resx | Adds menu/dialog/a11y strings for the calibration visualizer (Japanese). |
| src/InputBox/Resources/Strings.fr.resx | Adds menu/dialog/a11y strings for the calibration visualizer (French). |
| src/InputBox/Resources/Strings.de.resx | Adds menu/dialog/a11y strings for the calibration visualizer (German). |
| src/InputBox/Resources/Strings.Designer.cs | Regenerates resource accessors for newly added strings. |
| src/InputBox/MainForm.cs | Adds/clarifies XML doc comments on lifecycle/window message handlers. |
| src/InputBox/MainForm.Events.cs | Adds ShowGamepadCalibrationDialog() entry point to open the visualizer dialog. |
| src/InputBox/MainForm.ContextMenu.cs | Adds menu item to open calibration visualizer; adds setting-toggle vibration feedback for several toggles. |
| src/InputBox/MainForm.A11y.cs | Adds/clarifies partial-class summary for the a11y-focused MainForm partial. |
| src/InputBox/Core/Services/WindowNavigationService.cs | Updates method documentation to reflect cancellation token usage. |
| src/InputBox/Core/Services/PhraseService.cs | Fixes parameter documentation for temp-file naming/validation helper. |
| src/InputBox/Core/Services/ContextMenuBuilder.cs | Updates XML docs to include a restart item accessible description parameter. |
| src/InputBox/Core/Input/XInputGamepadController.cs | Adds live calibration snapshot tracking for visualization. |
| src/InputBox/Core/Input/IGamepadController.cs | Extends controller interface with CurrentCalibrationSnapshot. |
| src/InputBox/Core/Input/GamepadCalibrationSnapshot.cs | Adds the immutable snapshot type consumed by the visualizer and other diagnostics. |
| src/InputBox/Core/Input/GameInputGamepadController.cs | Adds live calibration snapshot tracking and updates it during polling/disconnect/reset paths. |
| src/InputBox/Core/Feedback/VibrationPatterns.cs | Adds SettingToggleOn/SettingToggleOff vibration profiles; documents global intensity multiplier. |
| src/InputBox/Core/Extensions/ControlExtensions.cs | Updates parameter documentation for dwell animation helper. |
| src/InputBox/Core/Controls/PhraseEditDialog.cs | Improves DPI-change handling to refresh shared fonts and eye-tracker feedback reliably. |
| src/InputBox/Core/Controls/GamepadMessageBox.cs | Removes stale XML doc param line in button-building helper docs. |
| src/InputBox/Core/Controls/GamepadCalibrationVisualizerMapper.cs | Adds helper for normalization clamping, deadzone radius conversion, and canvas mapping. |
| src/InputBox/Core/Controls/GamepadCalibrationDialog.cs | Adds the new calibration visualizer dialog UI, painting logic, a11y announcements, and controller navigation guards. |
| docs/engineering/git-commit-safety.md | Tightens policy wording: agents must not modify GPG config and must rely on user’s existing signing setup. |
| README.md | Documents calibration visualizer feature and the new “Minimize on Return” setting; expands calibration explanation. |
| GEMINI.md | Updates safety boundary text regarding GPG signing configuration constraints. |
| .github/copilot-instructions.md | Updates Copilot-specific guidance to match the stricter GPG signing constraints. |
| .agents/skills/inputbox-dev/SKILL.md | Updates the skill’s GPG-signing requirement wording to forbid agent-driven config changes. |
Files not reviewed (1)
- src/InputBox/Resources/Strings.Designer.cs: Language not supported
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: perditavojo <117562794+perditavojo@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: perditavojo <117562794+perditavojo@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: perditavojo <117562794+perditavojo@users.noreply.github.com>
Contributor
Author
|
@copilot apply changes based on the comments in this thread |
…tion snapshot update Agent-Logs-Url: https://github.com/rubujo/InputBox/sessions/e2f2ea31-1f92-470b-b364-3cfbb9dd5c31 Co-authored-by: perditavojo <117562794+perditavojo@users.noreply.github.com>
Contributor
Applied all three unresolved changes in commit c48bc8a:
|
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.
This pull request introduces several enhancements and clarifications to InputBox, focusing on controller calibration visualization, accessibility, settings, and compliance with GPG signing requirements. The most significant changes are grouped below:
1. Controller Calibration Visualization and Diagnostics
GamepadCalibrationVisualizerMapperutility for coordinate and deadzone calculations to support controller calibration visualization. (src/InputBox/Core/Controls/GamepadCalibrationVisualizerMapper.cs)GameInputGamepadControllerto maintain and update a real-time calibration snapshot, exposing it for visualization and diagnostics. (src/InputBox/Core/Input/GameInputGamepadController.cs) [1] [2] [3] [4] [5] [6] [7] [8]README.md) [1] [2]2. Settings and User Experience
README.md) [1] [2]src/InputBox/Core/Feedback/VibrationPatterns.cs)3. Accessibility and UI Robustness
PhraseEditDialog, ensuring fonts and accessibility feedback are updated correctly and robustly on DPI changes. (src/InputBox/Core/Controls/PhraseEditDialog.cs)src/InputBox/Core/Controls/PhraseEditDialog.cs,src/InputBox/Core/Extensions/ControlExtensions.cs) (Fd9478a4L8R8, [1] [2] [3]4. GPG Signing and Compliance Policy Updates
docs/engineering/git-commit-safety.md,.github/copilot-instructions.md,.agents/skills/inputbox-dev/SKILL.md,GEMINI.md) [1] [2] [3] [4]5. Minor UI and Documentation Tweaks
GamepadMessageBox. (src/InputBox/Core/Controls/GamepadMessageBox.cs)src/InputBox/Core/Controls/PhraseEditDialog.cs) (Fd9478a4L8R8)These changes collectively improve controller usability, diagnostics, accessibility, user feedback, and ensure strict compliance with security and signing standards.