Repository navigation
feat(linux): support both GTK 4 (default) and GTK 3 backends - #107
Merged
Merged
Conversation
lijy91
force-pushed
the
feat/linux-gtk4-backend
branch
from
December 1, 2026 00:00
077846f to
1e750ec
Compare
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.
Closes #103
Summary
NATIVEAPI_LINUX_BACKENDCMake option (GTK4default,GTK3opt-in) resolvinggtk4orgtk+-3.0and exportingNATIVEAPI_LINUX_GTK4/NATIVEAPI_LINUX_GTK3publicly.src/*.h) and C ABI (src/capi/*.h) headers completely backend-agnostic, and keep all Linux sources undersrc/platform/linux/*.cppcompiling under both GTK 4 and GTK 3 viagtk_compat_linux.h/gtk_x11_compat_linux.h.application,window,window_manager,window_close,window_drag_session,window_shadow,view,view_controls,menu,tray_icon,file_dialog,message_dialog,display,display_manager,clipboard,drag_source,drop_target,accessibility_manager,shortcut_manager) while preserving GTK 3 support.GTK4+GTK3withlddlinkage checks), and documentation (docs/linux-gtk.md,README.md).Verification
Verified on Linux (
omarchy, GTK 4.24.1 + GTK 3.24.52, Wayland / Hyprland):cmake -S . -B build-gtk4(default): all examples and tests build;lddlinks onlylibgtk-4.so.1(zerolibgtk-3references);ctestpasses 37/37 (headless and Wayland).cmake -S . -B build-gtk3 -DNATIVEAPI_LINUX_BACKEND=GTK3: all examples and tests build;lddlinks onlylibgtk-3.so.0/libgdk-3.so.0(zerolibgtk-4references).display_example,tray_color_example --self-test, andwindow_lifecycle_example.