Skip to content

Add window refresh callback - #1133

Merged
skallweitNV merged 1 commit into
mainfrom
dev/skallweit/window-refresh
Sep 3, 2026
Merged

Add window refresh callback#1133
skallweitNV merged 1 commit into
mainfrom
dev/skallweit/window-refresh

Conversation

@skallweitNV

Copy link
Copy Markdown
Contributor

Summary

Add an on_refresh callback to Window, invoked when GLFW reports that the window contents need to be redrawn.

  • Expose the callback through the native and Python APIs
  • Register the GLFW window refresh handler
  • Include the Python callback in garbage-collection traversal
  • Add the callback to the generated API documentation

Expose GLFW window refresh events through Window::on_refresh in both the native and Python APIs. Track the Python callback during garbage collection and include it in the generated API documentation.
@skallweitNV
skallweitNV requested a review from a team as a code owner September 3, 2026 06:11
@skallweitNV
skallweitNV requested review from bmillsNV and removed request for a team September 3, 2026 06:11
@jhelferty-nv
jhelferty-nv removed the request for review from bmillsNV September 3, 2026 06:11
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Window refresh events now flow from GLFW through the native Window callback to the Python on_refresh property. The binding keeps the callback reachable during garbage collection, and generated documentation includes the new symbols.

Window refresh callbacks

Layer / File(s) Summary
Native refresh event flow
src/sgl/core/window.h, src/sgl/core/window.cpp
The native Window API adds refresh callback storage, accessors, and handling. GLFW registers the refresh handler, which invokes the configured callback.
Python refresh binding
src/slangpy_ext/core/window.cpp, src/slangpy_ext/py_doc.h
Python exposes a nullable read-write on_refresh property. Garbage-collection traversal visits the callback, and generated documentation describes the new symbols.

Merge Risk: 🟠 High · up to f79ec

The new refresh callback can terminate the application if user callback code throws during event processing. Exception handling at the GLFW boundary should be added before merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a window refresh callback.
Description check ✅ Passed The description accurately summarizes the native and Python API changes, GLFW registration, garbage-collection traversal, and documentation updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 3 files. (1 skipped: 1 too large.)

  • Fix all pre-merge checks with AI

Warning

Some tools did not complete. Review the errors below.

🔧 ast-grep (0.45.2)
src/slangpy_ext/py_doc.h

ast-grep timed out on this file


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: 01c32cf1-6be8-41f0-8124-25123365eb3e

📥 Commits

Reviewing files that changed from the base of the PR and between 47f06a1 and f79ecad.

📒 Files selected for processing (4)
  • src/sgl/core/window.cpp
  • src/sgl/core/window.h
  • src/slangpy_ext/core/window.cpp
  • src/slangpy_ext/py_doc.h

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.

Comment thread src/sgl/core/window.cpp
@skallweitNV
skallweitNV merged commit f31158d into main Sep 3, 2026
23 checks passed
@skallweitNV
skallweitNV deleted the dev/skallweit/window-refresh branch September 3, 2026 06:44
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.

4 participants