Skip to content

fix(x11): Disable GDK frame sync on embedded webview window - #23835

Merged
ramezgerges merged 3 commits into
unoplatform:masterfrom
ramezgerges:fix/x11-webview-mutter-frame-sync
Jul 23, 2026
Merged

ramezgerges merged 3 commits into
unoplatform:masterfrom
ramezgerges:fix/x11-webview-mutter-frame-sync

Conversation

@ramezgerges

@ramezgerges ramezgerges commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #23159

PR Type:

🐞 Bugfix

What changed? 🚀

On GNOME (Mutter — both Xorg and XWayland sessions), WebView2 on Skia X11 renders a permanently blank panel. Historically it was flaky (blank until scrolling forced a repaint); since 6.7.0-dev.123 (#23736) it stopped rendering entirely.

Root cause

Mutter advertises _NET_WM_FRAME_DRAWN (compositor frame synchronization), so GDK paints a frame only after the WM acknowledges the previous one. The WebKitGTK window hosting the webview is reparented into the application's X11 window and is therefore never managed by the WM — no acknowledgement ever arrives, GDK's frame clock stalls, and WebKit stops painting. The X11 side is entirely healthy (correct parent, mapped, viewable, correct geometry); the window is just never drawn into.

Weston (WSLg) and wlroots-based compositors (sway, etc.) don't support frame sync, so GTK falls back to a timer-driven frame clock there — which is why the issue only reproduces on GNOME.

#23736 didn't regress this at the X11 level: before it, the marshaling bug in AttachSubWindow meant override-redirect was effectively never applied, so the window sometimes got briefly managed by Mutter during the map/attach race, letting a few frames through — the "blank until you scroll" flakiness reported in #23159. Making "never managed" deterministic made the stall permanent.

Fix

Call gdk_x11_window_set_frame_sync_enabled(window, FALSE) on the GDK window right after Realize() — GDK's opt-out for exactly this scenario. The override-redirect handling from #23736 is unchanged (still required for Weston's XWM).

Validation

  • Runtime, Mutter 46.2 (Ubuntu 24.04) headless XWayland: SamplesApp → WebView2_Basic renders the page with the fix; a negative control build (same everything minus the one call) reproduces the permanently blank webview. Fails-before / passes-after, screenshot-verified.
  • Runtime, WSLg (Weston XWM): page renders with the fix — no regression of the fix(x11): Fix WebView2 native element embedding on WSLg (Weston/XWayland) #23736 scenario.
  • GTK-level repro matrix replicating the exact embedding flow (realize → override-redirect → reparent → map → layout), across four XWMs (Weston, sway/wlroots, Mutter-on-XWayland, Mutter-on-Xorg) × both map/attach orderings × old/new attach variants: only frame-sync-disabled variants render everywhere; the current code fails only under Mutter, matching the field reports.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable) — covered by the existing WebView2_Basic manual-test sample; the failure depends on the window manager (GNOME/Mutter), which CI test environments don't exercise.
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features)
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

🤖 Generated with Claude Code

Mutter/GNOME (both Xorg and XWayland) advertises _NET_WM_FRAME_DRAWN, so
GDK waits for the WM to acknowledge each frame before painting the next
one. The webview window is reparented into the app's window and never
managed by the WM, so no acknowledgement ever comes, GDK's frame clock
stalls, and WebKit never paints (permanently blank webview).

Weston (WSLg) and wlroots compositors don't support frame sync, so this
is a no-op there.

fixes unoplatform#23159

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 21, 2026 20:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Linux/X11 WebView (WebKitGTK) host window initialization to disable GDK “frame sync” on the embedded/reparented WebView window, avoiding scenarios where GTK waits indefinitely for a window-manager frame acknowledgement that will never arrive for an unmanaged/reparented window (resulting in blank/non-updating WebView contents).

Changes:

  • Add a new libgdk-3.so P/Invoke for gdk_x11_window_set_frame_sync_enabled().
  • Disable GDK frame sync on the realized WebView toplevel window before it is mapped/reparented.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings July 21, 2026 20:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@unodevops

Copy link
Copy Markdown
Contributor

@ramezgerges
ramezgerges enabled auto-merge July 22, 2026 16:18
@ramezgerges
ramezgerges requested a review from jonpryor July 22, 2026 16:22
Copilot AI review requested due to automatic review settings July 22, 2026 19:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 223685 has failed on Uno.UI - CI.

@ramezgerges
ramezgerges merged commit 02b5732 into unoplatform:master Jul 23, 2026
47 checks passed
@ramezgerges
ramezgerges deleted the fix/x11-webview-mutter-frame-sync branch July 23, 2026 19:32
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.

[X11] WebView2 crash on Linux

4 participants