Repository navigation
Fix GTK focus echo and offscreen frame lag (follow-up to #85) - #93
Merged
Merged
Conversation
Focus() and ResignFocus() now activate and deactivate the GTK toplevel, so GTK raises focus-in/focus-out on the web view for them. Reporting those back re-entered the host's focus handling asynchronously: fast Tab navigation in Avalonia could pull focus back into the web view, and WPF raised GotFocus and LostFocus twice. The X11 click path still reports, since there the host doesn't know about the change yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The frame chain consumer picked the oldest unconsumed slot, and the slots the producer had never written count as unconsumed. So the first NextFrame took an empty slot, and from then on every draw showed the previous frame. Take the newest published frame and drop older ones. This replaces the InvalidateVisual workaround in NativeWebViewCompositorHost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to #85.
Don't report host-driven GTK focus changes back to the host
Since #85,
Focus()/ResignFocus()activate and deactivate the GTK toplevel, so GTK raisesfocus-in/focus-outon the web view for them. Those events were sent back to the host asynchronously:GotFocusarrived after focus had already moved on, andWithFocusOnGotFocuspulled focus back into the web view.GotFocus/LostFocuswere raised twice (WithFocusOnLostFocusdoesn't check_ignoreFocusChanges).GTK raises these events synchronously inside the call, so a flag set around host-driven focus changes now drops them. The X11 click handler uses a new
FocusFromWebView(), which still reports the change, because there the host doesn't know about it yet.Show the newest offscreen frame instead of the one before it
FrameChainBaseconsumer picked the oldest unconsumed slot, and the slots the producer had never written count as unconsumed. The firstNextFrame()took an empty slot, and after that every draw showed the previous frame. That is the "sparse update sits until the next one" symptom from #85. The consumer now takes the newest published frame and drops older ones. This replaces theInvalidateVisual()workaround inNativeWebViewCompositorHost, which added a UI render pass for every web frame.Testing
BitmapFrameChainTestscases. Both fail on main and pass with this change.🤖 Generated with Claude Code