Skip to content

fix(linux): stop shadow gutter layout loops on Wayland - #92

Open
yiguodev wants to merge 3 commits into
libnativeapi:mainfrom
YuanDevTeam:fix/linux-shadow-layout-loop
Open

yiguodev wants to merge 3 commits into
libnativeapi:mainfrom
YuanDevTeam:fix/linux-shadow-layout-loop

Conversation

@yiguodev

@yiguodev yiguodev commented Nov 8, 2026

Copy link
Copy Markdown

Summary

Fix a GTK layout/repaint loop when hiding a Linux window's title bar. GTK rewrites CSD shadow widths during allocation; declaring a second set of widths from the allocation callback keeps scheduling more layout work.

CSD:     GTK decoration margin owns the shadow gutter
non-CSD: declare GDK extents only when the surface or extents change

Keep CSD content sizing and frameless behavior consistent with GTK, invalidate fallback declarations across surface/style/scale changes, and add a real GTK regression test.

Evidence

  • Before: a static Flutter window reproduced the loop without application services. Steady-state main-thread CPU was approximately 96–100%; the new regression fails against unmodified upstream.
  • After: the GTK regression passes on Wayland and X11, including unchanged/changed extents, scale notifications, surface recreation, resize, remap, and decoration restoration.
  • Rebuilt a downstream Flutter application against this core checkout on GNOME Wayland: all 28 checks pass for startup, rasterized frames, in-app navigation, resize, maximize/restore, hide/show, and return to idle. No preload interceptor or X11 fallback was used.
  • git diff --check passes.

Run the native regression with:

cmake -S . -B build -DNATIVEAPI_BUILD_EXAMPLES=OFF -DBUILD_TESTING=ON
cmake --build build --target window_shadow_gutter_linux_test
GDK_BACKEND=wayland ctest --test-dir build -R '^window_shadow_gutter_linux_test$' --output-on-failure
GDK_BACKEND=x11 ctest --test-dir build -R '^window_shadow_gutter_linux_test$' --output-on-failure

Merge Danger

Door: Two-way.

Blast Radius: Linux GTK window geometry.

No public API/ABI or persisted-data changes. The live application checks were on GNOME Wayland; KWin/Hyprland and physical mixed-DPI transitions were not tested.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T07:06:25.162630Z 1a4c41b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39eda5f08d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/platform/linux/window_linux.cpp Resolved
Comment thread src/platform/linux/window_linux.cpp Resolved

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75306a011e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant