Skip to content

gtk: present the framebuffer (size the picture, tick the frame clock) - #93

Merged
tannevaled merged 1 commit into
mainfrom
feat/gtk-frame-tick
Aug 31, 2026
Merged

gtk: present the framebuffer (size the picture, tick the frame clock)#93
tannevaled merged 1 commit into
mainfrom
feat/gtk-frame-tick

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

The GTK4-hosted window came up blank, on two counts:

  1. The GtkPicture was Put into the GtkFixed at 0,0 with no size; a GtkFixed gives each child its requested size, and a content-less GtkPicture requests 0×0 — so the framebuffer was laid out invisibly. Now sized to the logical window.
  2. Run() presented one frame, before the window was mapped (frame clock not started) and before an immediate-mode app's Surface had content — freezing empty. Now driven by Widget.AddTickCallback (go-gtk v0.2.4): the GdkFrameClock ticks while mapped, quiescent when not; syncNative reconciles controls by key, so ticking never rebuilds them or fights a caret.

Proven end-to-end: go-news-reader -window under Xvfb now renders its full UI (topbar with the overlaid native GtkEntry search field, sidebar, item list, preview) through go-gtk/purego, CGO=0. Bumps go-gtk v0.2.1 → v0.2.4.

The GTK4-hosted window came up blank: the GtkPicture was Put into the GtkFixed at
0,0 with no size, and a GtkFixed gives each child its requested size — a
content-less GtkPicture requests 0×0, so the framebuffer was laid out invisibly.
Size the picture to the logical window.

And present every frame, not once. Run() drew a single frame before the window was
mapped (the frame clock had not started) and before an immediate-mode app's Surface
had any content — so it froze empty. Drive frame() from Widget.AddTickCallback
(go-gtk v0.2.4): the GdkFrameClock ticks while the window is mapped, quiescent when
not; syncNative reconciles controls by key, so ticking never rebuilds them.

Proven end to end: go-news-reader -window under Xvfb now renders its full UI (topbar
with the overlaid native GtkEntry search field, sidebar, item list, preview) at
~57fps through go-gtk/purego, CGO=0. Bumps go-gtk v0.2.1 → v0.2.4.
@tannevaled
tannevaled merged commit 0ca9946 into main Aug 31, 2026
28 checks passed
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