gtk: GTK4-hosted Linux backend — native controls over a GtkPicture framebuffer - #90
Merged
Conversation
…amebuffer The third native-control host, the sibling of internal/cocoa and internal/win32. GTK owns the window (github.com/go-gtk/gtk4, pure-Go over purego, no cgo); the toolkit's pixel framebuffer is presented in a GtkPicture each frame, and native platform controls (toolkit.NativeControl) are real GtkEntry/GtkButton/GtkCheckButton overlaid above it in a GtkFixed. It runs the same descriptor reconcile (gatherNative + syncNative) the cocoa and win32 backends do, with the same immediate-mode-safe value-diff binding, so a Surface app's secure field, button and checkbox become real GTK widgets with no app changes. Selected by $GO_WIDGETS_GTK (opt-in, so the default stays the dependency-free from-scratch X11/Wayland backends); needs the libgtk-4 runtime. Proven on real GTK4 under Xvfb (TestGTKBackendReconcilesControls + a new live-gtk CI lane): a secure-entry descriptor becomes a GtkEntry whose value round-trips, follows an app-side change, and is reconciled away when the descriptor disappears. Slider and pop-up are not yet hosted (pending trackbar/combo in the binding); input routing to the drawn surface and continuous frame ticking are the next steps. Requires go-gtk/gtk4 v0.2.0.
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.
The third native-control host — the Linux sibling of
internal/cocoaandinternal/win32. Completes native controls on all three OSes.How
GTK owns the window (
go-gtk/gtk4v0.2.0, pure-Go over purego, no cgo). The toolkit's pixel framebuffer is presented in aGtkPictureeach frame (GdkMemoryTexture), and native controls (toolkit.NativeControl) are realGtkEntry/GtkButton/GtkCheckButtonoverlaid in aGtkFixedabove it. It runs the samegatherNative+syncNativedescriptor reconcile the cocoa/win32 backends do, with the same immediate-mode-safe value-diff binding — so a Surface app's secure field, button and checkbox become real GTK widgets with no app changes.Selection
Opt-in via
$GO_WIDGETS_GTK, so the default stays the dependency-free from-scratch X11/Wayland backends; the GTK path needs thelibgtk-4runtime (no-dev).Proof
TestGTKBackendReconcilesControls+ a newlive-gtkCI lane (libgtk-4 + Xvfb): a secure-entry descriptor becomes aGtkEntrywhose value round-trips, follows an app-side change, and is reconciled away when the descriptor disappears. All platforms build (android/darwin/windows via the binding's stub); Backend conformance asserted.Follow-ups (noted, not blocking)
Slider/pop-up hosting (pending trackbar/combo in the binding); input routing to the drawn surface + continuous frame ticking; native radio grouping via GTK groups. The core (present + control reconcile) is proven.