Skip to content

Issue 94804 gtk4 linux v2 - #186594

Closed
richyo-codes wants to merge 60 commits into
flutter:masterfrom
richyo-codes:issue-94804-gtk4-linux-may-rebase-v2
Closed

richyo-codes wants to merge 60 commits into
flutter:masterfrom
richyo-codes:issue-94804-gtk4-linux-may-rebase-v2

Conversation

@richyo-codes

@richyo-codes richyo-codes commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Issue 94804

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems tool Affects the "flutter" command-line tool. See also t: labels. engine flutter/engine related. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) f: scrolling Viewports, list views, slivers, etc. platform-linux Building on or for Linux specifically a: desktop Running on desktop d: docs/ flutter/flutter/docs, for contributors team-linux Owned by the Linux platform team labels May 15, 2026
@richyo-codes
richyo-codes force-pushed the issue-94804-gtk4-linux-may-rebase-v2 branch 5 times, most recently from 8d69db0 to c5694ec Compare June 1, 2026 05:29
@richyo-codes richyo-codes changed the title Issue 94804 gtk4 linux may rebase v2 Issue 94804 gtk4 linux v2 Jun 21, 2026
@richyo-codes
richyo-codes force-pushed the issue-94804-gtk4-linux-may-rebase-v2 branch from 96f0a29 to 11ed8f4 Compare June 21, 2026 22:31
Introduce the compatibility headers, accessibility semantics store, and GN plumbing needed to support GTK3 and GTK4 side by side without yet splitting the main runtime files.
Keep GTK3 as the default runtime path while teaching the shared Linux shell sources to build under GTK4 without the GTK3-only accessibility and widget APIs. This stage keeps the file layout mostly intact so the later refactor/split commits stay reviewable.
Move the GTK4 clipboard implementation out of the shared platform handler into a dedicated translation unit. The GTK3 path keeps its existing clipboard code, while the GTK4 path now has its own self-contained helper file and GN wiring.
Move the GTK4 cursor-position and IM context widget wiring out of fl_text_input_handler.cc into a dedicated GTK4 translation unit, and keep the shared handler using a private struct header for the split fields.
Purge semantics nodes that are no longer present after a full accessibility update so the cache does not retain dead ATK objects, and add a regression test that proves removed nodes finalize once the caller releases its own reference.
Move the GTK4 view setup, cursor handling, and legacy event controller plumbing into a dedicated translation unit, and move the private FlView state into a shared header so the GTK4 helper can use it without changing GTK3 behavior.
Move the GTK3 event and gesture setup out of fl_view.cc into a dedicated GTK3 translation unit. This keeps the shared view file focused on the common shell wiring and matches the existing GTK4 helper split.
@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. and removed d: docs/ flutter/flutter/docs, for contributors labels Jun 21, 2026
Extract the GL texture drawing and readback painting paths into dedicated helpers so the shared compositor render function stays linear. This keeps the GTK4-specific deprecation handling isolated without changing the underlying framebuffer flow.
Move the GTK4 application window creation and first-frame presentation helpers into a dedicated translation unit. The shared application code now keeps the GTK3 path in place while the GTK4 setup lives alongside the other GTK4-specific helpers.
Move the GTK4 monitor enumeration into a dedicated translation unit so the shared display monitor logic stays focused on the engine update flow. The GTK3 path remains in the original file.
Teach the GTK4 render path to acquire a GdkTexture from the compositor and present it through the GTK4 render texture widget. Keep the legacy GTK3 Cairo path intact and add the software compositor texture fallback so GTK4 continues to work with both renderer types.
Thread the selected GTK variant through build, run, native assets, build directories, Dart defines, project pubspec defaults, and flutter config fallback.
@github-actions github-actions Bot added the d: docs/ flutter/flutter/docs, for contributors label Jun 21, 2026
Map GTK4 GDK event positions through the native surface transform into the Flutter render widget before sending pointer events. This keeps hover and click hit testing aligned with rendered content when GTK4 window chrome or widget transforms shift raw event coordinates.
Pass the GTK4 render-area pixel size into compositor texture acquisition instead of deriving it from the surface. Avoid waiting for a zero-sized frame during startup by retrying once the render area has a real allocation.
GTK4 no longer exposes the GTK3 display monitor-added/monitor-removed signals or GtkWidget::delete-event. Observe the GTK4 monitor list model instead and connect close handling through GtkWindow::close-request.
…e-94804-gtk4-linux-pr-stack-v7

Resolve the gtk4/linux and flutter_tools merge conflicts, with the Linux shell updates kept in sync and the darwin deployment target/template changes applied.
Add fl_compositor_opengl_shader.cc to the gtk4 source set and keep the linux GTK3/GTK4 split aligned with the shared OpenGL compositor implementation.
Add a GTK4 runtime API table for optional accessibility symbols and route gtk_accessible_set_accessible_parent through it when FLUTTER_LINUX_GTK4_RUNTIME_API_COMPAT is enabled. This lets GTK4 builds compiled against older headers use newer accessibility APIs when present at runtime without creating direct symbol relocations.
Resolve optional GTK4 accessibility APIs through a single runtime compat layer so the engine can keep building against the older GTK4 sysroot while opportunistically using newer tree and value-update entry points when available.
Make the GTK4-only runtime compat implementation file explicit in its name and update the Linux GN source list accordingly.
Rename the GTK4 runtime compat header to match the implementation file and use the runtime-resolved GTK4 announcement API so accessibility notifications are no longer dropped on the GTK4 path.
Keep the GTK4 semantics store live on each view, feed it from update-semantics, and use the cached root label when updating the view accessibility name.
Teach the Linux build to select a trixie x64 sysroot alongside bullseye so the engine can target both GTK4 baselines without changing the build flow.
Build the GTK4 accessibility tree from the semantics store behind a compile-time toggle, keep the GTK3 ATK path unchanged, and route GTK4 runtime accessibility updates through the compat layer.
Describe the native Linux popup and multi-window entrypoints, their GTK3 versus GTK4 behavior, and how sample apps such as flutter_multi_window_ffi_test should consume them.
Resolve the renderer refactor merge while preserving GTK4 accessibility integration and the unified GTK3/GTK4 build paths.
Thread the VPYTHON_BYPASS environment through both GN generation and autoninja so the GTK4 compatibility build can regenerate in this environment. Also keep fl_view_test.cc out of the GTK4 unittest target so the GTK4 build stays free of GTK3-only ATK mocks.
Build a native GtkAccessible tree from Flutter semantics and expose it through the renderer on GTK 4.10 and newer. Resolve additive traversal APIs at runtime so GTK 4.8 remains the build and runtime fallback baseline, and validate both paths in distro containers.
Do not disconnect or unref the borrowed GdkKeymap after converting its signal handler to g_signal_connect_object. Destroying the display-owned keymap corrupts GDK keyboard state and can trigger xkb_state_unref failures during app startup.
adonm added a commit to adonm/flutter-dev that referenced this pull request Aug 15, 2026
Both applications now consume the official Flutter beta with the stock
GTK3 embedder, so the sdk/ and plugins/ submodules and the engine/SDK
build-and-publish pipeline are no longer needed. The workspace keeps
apps/zuko, apps/vixen, and the libghostty/flterm fork; the retired
framework work lives on in the adonm/flutter fork for the upstream GTK4
effort (flutter/flutter#186594).
@richyo-codes

Copy link
Copy Markdown
Contributor Author

Started a new PR here #193405 with intent to actually get reviewed

Closing this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems d: docs/ flutter/flutter/docs, for contributors engine flutter/engine related. See also e: labels. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. platform-linux Building on or for Linux specifically team-linux Owned by the Linux platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant