Fix embedded webview geometry on scaled displays (PR #63 + review follow-ups) - #66
Merged
Merged
Conversation
Windows (Canvas 6 operation 17): - Factor the set_bounds resize into fit_child_to_parent, which zero-initialises its RECT and leaves the child and controller untouched when GetClientRect on the canvas HWND fails. - Keep the child HWND sized to the canvas HWND even when Java fires no componentResized (e.g. the frame moves to a monitor with a different scale). A refcounted, thread-specific WH_CALLWNDPROCRET hook on the AWT toolkit thread watches the canvas's WM_SIZE / WM_WINDOWPOSCHANGED and posts WM_EMBED_FIT_PARENT to the child. AWT's window procedure is never replaced, and the hook only posts. Linux lightweight (Canvas 33 D2): - Move the offscreen park into gtk_off_park_offscreen and re-run it from a notify::scale-factor handler, so a runtime window-scale change cannot leave the hidden popup wrapped on screen. Correct the media analysis's off-screen rationale to account for scale. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HKYwyMrdMwg5rJNj38hxvj
shannah
marked this pull request as ready for review
October 3, 2026 14:11
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 branch starts from @Aunali321's commit in #63 (
6cbe02d, kept as-is) and adds one commit that addresses the points raised in the review of that PR.Included from #63
webview_embed_set_boundssizes the child HWND and the WebView2 controller from the canvas HWND's client rect instead of from AWT user-spacew, h.-32000offset is divided by the window scale, so it no longer wraps on screen at 2x.Follow-ups (this branch)
Windows (Canvas 6 §6 + new operation 17)
fit_child_to_parentis now the one resize routine. It zero-initialises theRECTand returns early ifGetClientRecton the canvas HWND fails, so a late dispatched op can no longer push garbage bounds.componentResized. Example: the frame is dragged to a monitor with a different scale, so the canvas's device size changes but its user-space size doesn't. A thread-specificWH_CALLWNDPROCREThook on the AWT toolkit thread watches the canvas'sWM_SIZEandWM_WINDOWPOSCHANGED(size changed) and postsWM_EMBED_FIT_PARENTto ourWebViewEmbedChild. The hook is refcounted per thread, acquired increate_engineandadopt_retained_popup, and released indestroy_engine. AWT's window procedure is never replaced, and the hook only posts. It never callsSendMessage, so the AWT thread can't block on the worker.Linux lightweight (Canvas 33 D2)
gtk_off_park_offscreennow does the scale-aware move. It runs once before the popup is shown, and again from anotify::scale-factorhandler, so a runtime change toGdk/WindowScalingre-parks the popup off screen.SPDD
/spdd-prompt-update→/spdd-generate.Verification
xvfb-run ./run-linux-media-smoketest.shpasses all checks (A, B, P). WithGDK_SCALE=2,xwininfoshows the popup at+-32000+-32000device px. The runtime scale-change path was not exercised: it needs a live X settings daemon.-Wall -Wextraagainst realwindows.h. The full file needs MSVC/WRL, so CI has to confirm it. Needs on-device check: at a scale above 100%, drag the frame between monitors of different scale and confirm the page still fills the canvas without resizing the frame.🤖 Generated with Claude Code
https://claude.ai/code/session_01HKYwyMrdMwg5rJNj38hxvj
Generated by Claude Code