Skip to content

feat(linux): support both GTK 4 (default) and GTK 3 backends - #107

Merged
lijy91 merged 2 commits into
mainfrom
feat/linux-gtk4-backend
Dec 1, 2026
Merged

lijy91 merged 2 commits into
mainfrom
feat/linux-gtk4-backend

Conversation

@lijy91

@lijy91 lijy91 commented Nov 30, 2026

Copy link
Copy Markdown
Member

Closes #103

Summary

  • Add NATIVEAPI_LINUX_BACKEND CMake option (GTK4 default, GTK3 opt-in) resolving gtk4 or gtk+-3.0 and exporting NATIVEAPI_LINUX_GTK4 / NATIVEAPI_LINUX_GTK3 publicly.
  • Keep public C++ (src/*.h) and C ABI (src/capi/*.h) headers completely backend-agnostic, and keep all Linux sources under src/platform/linux/*.cpp compiling under both GTK 4 and GTK 3 via gtk_compat_linux.h / gtk_x11_compat_linux.h.
  • Implement GTK 4 support across all GTK-dependent Linux modules (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.
  • Update Linux examples, cross-backend tests, CI matrix (GTK4 + GTK3 with ldd linkage 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; ldd links only libgtk-4.so.1 (zero libgtk-3 references); ctest passes 37/37 (headless and Wayland).
  • cmake -S . -B build-gtk3 -DNATIVEAPI_LINUX_BACKEND=GTK3: all examples and tests build; ldd links only libgtk-3.so.0 / libgdk-3.so.0 (zero libgtk-4 references).
  • Real Wayland runtime examples passed under GTK 4: display_example, tray_color_example --self-test, and window_lifecycle_example.

@lijy91
lijy91 force-pushed the feat/linux-gtk4-backend branch from 077846f to 1e750ec Compare December 1, 2026 00:00
@lijy91
lijy91 merged commit 94961b7 into main Dec 1, 2026
11 checks passed
@lijy91
lijy91 deleted the feat/linux-gtk4-backend branch December 1, 2026 00:37
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.

[Linux] Support both GTK 4 (default) and GTK 3 backends

1 participant