Skip to content

feat(windows): Windows C++ native platform implementation - #358

Open
khaphanspace wants to merge 17 commits into
mainfrom
feat/windows-platform
Open

feat(windows): Windows C++ native platform implementation#358
khaphanspace wants to merge 17 commits into
mainfrom
feat/windows-platform

Conversation

@khaphanspace

Copy link
Copy Markdown
Owner

Summary

  • Full Windows platform using C++17/Win32 native UI with Rust core FFI
  • CMake + Corrosion build system (x64/ARM64)
  • Global keyboard hook via SetWindowsHookEx
  • Modern settings window (DPI-aware, light/dark theme)
  • Per-app IME state persistence via Registry
  • Auto-update checker via GitHub releases API

Files

  • platforms/windows/src/ — 28 C++ source files (14 .cpp + 14 .h)
  • platforms/windows/CMakeLists.txt — build config
  • scripts/build-windows.ps1 — PowerShell build script
  • docs/install-windows.md — user install guide
  • .gitignore — add platforms/windows/build/

Test plan

  • All 600+ Rust core tests pass
  • Windows build compiles on CI
  • Manual test: typing Vietnamese in Notepad, Chrome, VS Code
  • Settings UI: toggle switches, input method selection
  • System tray: icon, context menu, enable/disable

Replaces #357 (cleaned up merge history)

Full Windows platform using C++17/Win32 native UI with Rust core FFI:

- CMake + Corrosion build system (x64/ARM64)
- Global keyboard hook via SetWindowsHookEx
- System tray with context menu
- Modern settings window (DPI-aware, light/dark theme)
- Per-app IME state persistence via Registry
- Shortcuts dialog with import/export
- Auto-update checker via GitHub releases API
- PowerShell build script for local development
- Add build-windows target using PowerShell build script
- Add windows build dir to clean target
- Update help text
- Fix font handle leaks in AboutDialog (store as members, delete in dtor)
- Fix detached thread UaF in UpdateChecker (joinable thread, join in dtor)
- Fix static bgBrush leak in settings_window (recreate on theme change)
- Fix thread safety in PerAppMode (lock GetAppState/SetAppState)
- Fix deprecated codecvt in shortcuts import/export (use Win32 API)
- Fix license mismatch: MIT → GPL-3.0 in resources.rc and about dialog
- Fix wrong GitHub URLs in DEBUGGING.md and README.md
- Remove dead DialogProc and unnecessary const_cast in settings_window
- Deduplicate CMake source list into GONHANH_SOURCES variable
- Reduce 16KB stack buffer to 256 chars in per_app registry enum
- Restore *.profraw/*.profdata in .gitignore for Rust coverage
- 150ms ease-out cubic slide animation for knob position
- Track color blends smoothly between off/on states
- Pressed state: knob shrinks 15% on mouse down (Windows 11 squish)
- SetToggleState snaps instantly (no animation on settings load)
- ~60fps via WM_TIMER, auto-kills when animation completes
- Double-buffered rendering prevents flicker during animation
- Toggle rows: 36dp (from 40dp) — tighter for single-line items
- Subtitle rows (shortcuts section): 44dp — proper space for title+subtitle
- Section gap: 14dp (from 6dp) — clear visual separation between groups
- Remove sectionGap padding — rows now flow with uniform rowHeight
- Add thin divider lines at section boundaries (section 1→2, 3→4)
- Store dividerY positions, update on scroll
- Consistent vertical rhythm: no more uneven gaps between sections
- Store tab hit rects (tabSettingsRect_, tabAboutRect_)
- Handle clicks: Settings tab stays on settings, About tab opens AboutDialog
- Hand cursor on hover for sidebar tabs
- SwitchTab() hides/shows settings controls per active tab
- PaintAbout() renders logo, version, description, license in content area
- No more popup dialog — About content displayed inline
- Shortcuts click guarded to settings tab only
- Centered layout: logo → name → tagline → version → buttons → footer
- 3 clickable link cards: Ủng hộ, Báo lỗi, GitHub (opens in browser)
- Footer: author credit and GPL-3.0 license
- Hand cursor on about button hover
- Content matches macOS AboutPageView
- DrawHeartIcon: filled heart shape (pink, for Sponsor)
- DrawBugIcon: bug with legs (for Report bug)
- DrawCodeIcon: </> brackets (for GitHub)
- Icons drawn centered above label text in each button card
Replace custom GDI+ icon drawing with native Windows icon font.
Uses Segoe Fluent Icons (Win11) with Segoe MDL2 Assets fallback (Win10).
Icons: HeartFill (E0xEB51), Bug (0xEBE8), DeveloperTools (0xEC7A).
…ooter

- "Kha Phan" → blue underline, opens LinkedIn
- "Cộng đồng" → blue underline, opens CONTRIBUTORS.md
- Hand cursor on hover for both links
- Text segments measured and centered as a single line
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.

1 participant