gtk

package
v0.71.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package gtk is the GTK4-hosted Linux back-end: instead of blitting to a from-scratch X11/Wayland surface, GTK owns the window, the toolkit's pixel framebuffer goes in a GtkPicture, and native platform controls (toolkit.NativeControl) are real GtkEntry/GtkButton/… overlaid above it in a GtkFixed. It links no cgo — everything is github.com/go-gtk/gtk4 over purego.

It is the third native-control host, the sibling of internal/cocoa and internal/win32, and runs the same NativeControl descriptor reconcile (syncNative) they do — but here the widgets are GTK's, so a radio group finally groups properly rather than sharing one global action.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Window

type Window struct {
	// contains filtered or unexported fields
}

Window is the GTK4-hosted back-end window. It satisfies the window.Backend contract (Run/Close/Size/String).

func Open

func Open(title string, width, height int, theme *toolkit.Theme, scale float64) (*Window, error)

Open creates the GTK window (but does not enter the loop; Run does). width and height are logical points; scale is framebuffer pixels per point.

func (*Window) Close

func (w *Window) Close() error

Close quits the loop and drops the window.

func (*Window) Repaint added in v0.63.0

func (w *Window) Repaint()

Repaint asks for a frame from any goroutine. It implements github.com/go-widgets/window.Repainter: the application present loop calls it (gated by the handler's NeedsPresent), and a background producer that has queued a scene change may call it directly. It only raises a flag the frame clock reads on the main thread, so it makes no GTK call off that thread and never allocates a callback — cheap enough to call every tick.

func (*Window) Run

func (w *Window) Run(root toolkit.Widget) error

Run binds root and drives the GLib main loop until the window is closed. It presents a frame only when one was asked for — see Window.Repaint.

func (*Window) Size

func (w *Window) Size() (int, int)

Size returns the current framebuffer size in pixels.

func (*Window) String

func (w *Window) String() string

String identifies the window.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL