Skip to content

fix(windows-ui): wire generic widget click callbacks - #7072

Merged
proggeramlug merged 2 commits into
mainfrom
fix/6614-windows-widget-onclick
Jul 30, 2026
Merged

fix(windows-ui): wire generic widget click callbacks#7072
proggeramlug merged 2 commits into
mainfrom
fix/6614-windows-widget-onclick

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • retain generic Windows widget click callbacks instead of discarding them
  • dispatch left-button releases through the existing HWND subclass path
  • enable SS_NOTIFY for STATIC controls so text/image-backed widgets receive mouse input
  • cover callback replacement in the registration map

Verification

  • cargo check --tests --target x86_64-pc-windows-msvc -p perry-ui-windows
  • cargo fmt --all -- --check

Closes #6614

Summary by CodeRabbit

  • Bug Fixes
    • Fixed click handlers on Windows so they work reliably for text, images, stacks, static controls, and other non-button widgets.
    • Click callbacks now fire correctly from the widget’s native window, including when click notifications are explicitly enabled.
    • Updated callback handling ensures the latest registered click handler is used.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 294f52b8-8bf1-4868-a004-4b0182d7ad00

📥 Commits

Reviewing files that changed from the base of the PR and between cb2262a and ac33f1a.

📒 Files selected for processing (3)
  • changelog.d/7072-windows-widget-onclick.md
  • crates/perry-ui-windows/src/ffi/widget_layout_extras.rs
  • crates/perry-ui-windows/src/pointer.rs

📝 Walkthrough

Walkthrough

Windows generic .onClick callbacks are now registered through the widget FFI, stored per window handle, and invoked on WM_LBUTTONUP. STATIC controls receive SS_NOTIFY, and callback replacement is covered by a unit test.

Changes

Windows click callbacks

Layer / File(s) Summary
Pointer click registration and dispatch
crates/perry-ui-windows/src/pointer.rs, changelog.d/7072-windows-widget-onclick.md
Per-window click callbacks are stored, STATIC controls receive SS_NOTIFY, mouse-release handling invokes the callback, and replacement behavior is tested and documented.
Widget FFI registration wiring
crates/perry-ui-windows/src/ffi/widget_layout_extras.rs
perry_ui_widget_set_on_click forwards the widget handle and callback to Windows pointer registration.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WidgetFFI
  participant PointerModule
  participant WindowsControl
  participant JSCallback
  WidgetFFI->>PointerModule: register handle and callback
  PointerModule->>WindowsControl: enable SS_NOTIFY and subclass
  WindowsControl->>PointerModule: dispatch WM_LBUTTONUP
  PointerModule->>JSCallback: invoke registered click callback
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: wiring generic widget click callbacks on Windows.
Description check ✅ Passed The description includes a clear summary, verification commands, and the linked issue reference, with only minor template sections omitted.
Linked Issues check ✅ Passed The PR meets #6614 by retaining non-Button onClick callbacks, handling WM_LBUTTONUP, enabling SS_NOTIFY for STATIC controls, and adding replacement coverage.
Out of Scope Changes check ✅ Passed No significant out-of-scope code changes are evident; the additions align with the Windows click-callback fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/6614-windows-widget-onclick

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug merged commit df77229 into main Jul 30, 2026
1 of 7 checks passed
@proggeramlug
proggeramlug deleted the fix/6614-windows-widget-onclick branch July 30, 2026 15:34
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.

windows-ui: generic .onClick on non-Button widgets is a no-op

1 participant