driver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

NoClipBounds is the open clip rectangle walkObjectTree starts with: an object reached with this clip size has crossed no clipping ancestor.

Functions

func AbsolutePositionForObject

func AbsolutePositionForObject(object core.CanvasObject, trees []core.CanvasObject) geo.Position

AbsolutePositionForObject returns the absolute position of an object in a set of object trees. If the object is not part of any of the trees, the position (0,0) is returned.

func ClipBoundsForObject

func ClipBoundsForObject(object core.CanvasObject, trees []core.CanvasObject) (geo.Rectangle, bool)

ClipBoundsForObject returns the bounds of the nearest clipping ancestor of object within the given trees, in absolute canvas coordinates. ok is false when object is not found, or when no ancestor clips it (it is drawn against the full canvas). A clipping ancestor is one IsClip reports — a event.Scrollable, a bellui.Container with ClipToBounds, or a widget whose renderer clips. It reuses the same clip tracking the hit-test walk uses, so a caller can size content (e.g. a popover) to the region that will actually be visible rather than overflowing into a clipped area.

func FindObjectAtPositionMatching

func FindObjectAtPositionMatching(mouse geo.Position, matches func(object core.CanvasObject) bool, overlays []core.CanvasObject, roots ...core.CanvasObject) (core.CanvasObject, geo.Position, int)

FindObjectAtPositionMatching is used to find an object in a canvas at the specified position. The matches function determines of the type of object that is found at this position is of a suitable type. The various canvas roots and overlays that can be searched are also passed in.

func HandleEscape

func HandleEscape(c core.Canvas) bool

HandleEscape gives the Escape key its default meaning — close the innermost pop-up, menu or dialog — and reports whether it consumed the key. Drivers call it before delivering the key press, so a canvas-hosted dialog dismisses even though nothing inside it is focused.

The focused widget gets first refusal through event.EscapeHandler: while a text field is composing, or a cell is being edited in place, Escape belongs to that widget and no overlay closes. Everything else falls through, which is why a focused text field inside a dialog does not trap the user in it.

func IsClip

func IsClip(o core.CanvasObject) bool

func IsPathClip

func IsPathClip(o core.CanvasObject) (any, bool)

IsPathClip checks if a canvas object's renderer implements path-based stencil clipping. Returns the clip path (as any to avoid import cycles) and true if the renderer supports path clipping.

func IsRepaintBoundary

func IsRepaintBoundary(o core.CanvasObject) bool

IsRepaintBoundary checks if a canvas object's renderer implements the RepaintBoundary marker interface, indicating its subtree should be rendered into a cached FBO for dirty-region isolation.

func IsRoundedClip

func IsRoundedClip(o core.CanvasObject) (bool, float32)

IsRoundedClip checks if a canvas object's renderer implements rounded-corner stencil clipping. Returns the corner radius if so.

func PopDirectionScope

func PopDirectionScope(obj core.CanvasObject)

PopDirectionScope balances PushDirectionScope for obj. A non-scope obj is a no-op.

func PushDirectionScope

func PushDirectionScope(obj core.CanvasObject)

PushDirectionScope pushes obj's ambient layout direction onto the per-goroutine uidir stack when obj is a direction scope, so paint-time text base direction and leading/trailing alignment inside the subtree resolve against the scope rather than the process-global direction. It is the paint-time mirror of the layout hook in common.Canvas.EnsureMinSize and must be balanced by PopDirectionScope in the matching after-children callback. A non-scope obj is a no-op.

func ReverseWalkVisibleObjectTree

func ReverseWalkVisibleObjectTree(
	obj core.CanvasObject,
	beforeChildren func(core.CanvasObject, geo.Position, geo.Position, geo.Size) bool,
	afterChildren func(core.CanvasObject, geo.Position, core.CanvasObject),
) bool

ReverseWalkVisibleObjectTree will walk an object tree in reverse order for all visible objects executing the passed functions following the following rules: - beforeChildren is called for the start obj before traversing its children - the obj's children are traversed by calling walkObjects on each of the visible items - afterChildren is called for the obj after traversing the obj's children The walk can be aborted by returning true in one of the functions:

  • if beforeChildren returns true, further traversing is stopped immediately, the after function will not be called for the obj where the walk stopped, however, it will be called for all its parents

func WalkCompleteObjectTree

func WalkCompleteObjectTree(
	obj core.CanvasObject,
	beforeChildren func(core.CanvasObject, geo.Position, geo.Position, geo.Size) bool,
	afterChildren func(core.CanvasObject, geo.Position, core.CanvasObject),
) bool

WalkCompleteObjectTree will walk an object tree for all objects (ignoring visible state) executing the passed functions following the following rules: - beforeChildren is called for the start obj before traversing its children - the obj's children are traversed by calling walkObjects on each of the items - afterChildren is called for the obj after traversing the obj's children The walk can be aborted by returning true in one of the functions:

  • if beforeChildren returns true, further traversing is stopped immediately, the after function will not be called for the obj where the walk stopped, however, it will be called for all its parents

func WalkVisibleObjectTree

func WalkVisibleObjectTree(
	obj core.CanvasObject,
	beforeChildren func(core.CanvasObject, geo.Position, geo.Position, geo.Size) bool,
	afterChildren func(core.CanvasObject, geo.Position, core.CanvasObject),
) bool

WalkVisibleObjectTree will walk an object tree for all visible objects executing the passed functions following the following rules: - beforeChildren is called for the start obj before traversing its children - the obj's children are traversed by calling walkObjects on each of the visible items - afterChildren is called for the obj after traversing the obj's children The walk can be aborted by returning true in one of the functions:

  • if beforeChildren returns true, further traversing is stopped immediately, the after function will not be called for the obj where the walk stopped, however, it will be called for all its parents

Types

type InputPassThrough

type InputPassThrough interface {
	PassesInputThrough() bool
}

InputPassThrough is implemented by overlay roots that must not block input to the content beneath them — a tooltip, not a dialog. When the top overlay reports true, hit-testing falls through to the lower roots wherever the overlay itself has no match at the position.

type ObjectAtPosition

type ObjectAtPosition struct {
	Object   core.CanvasObject
	Position geo.Position
}

ObjectAtPosition holds an object found at a position along with the mouse position relative to it.

func FindAllObjectsAtPositionMatching

func FindAllObjectsAtPositionMatching(mouse geo.Position, matches func(object core.CanvasObject) bool, overlay core.CanvasObject, roots ...core.CanvasObject) []ObjectAtPosition

FindAllObjectsAtPositionMatching is like FindObjectAtPositionMatching but returns ALL matching objects at the position, ordered from deepest (innermost) to shallowest (outermost). This is used for scroll event propagation where the deepest scrollable gets first chance to handle the event, and if it doesn't consume it, the next parent scrollable tries.

type ScrollConsumer

type ScrollConsumer interface {
	event.Scrollable
	TryScrolled(ev *event.ScrollEvent) bool
}

ScrollConsumer is an optional interface for Scrollable objects that can report whether a scroll event was consumed. If TryScrolled returns false, the scroll event may propagate to a parent scrollable.

type WithContext

type WithContext interface {
	RunWithContext(f func())
	RescaleContext()
	Context() any
}

WithContext allows drivers to execute within another context. Mostly this helps GLFW code execute within the painter's GL context.

Directories

Path Synopsis
Package glfw provides a full Bellui desktop driver that uses the system OpenGL libraries.
Package glfw provides a full Bellui desktop driver that uses the system OpenGL libraries.
app
Package app lets you write portable all-Go apps for Android and iOS.
Package app lets you write portable all-Go apps for Android and iOS.
event/composition
Package composition defines the IME composition (preedit) event used by the mobile driver to carry input-method composition state from the native platform layer to the focused widget.
Package composition defines the IME composition (preedit) event used by the mobile driver to carry input-method composition state from the native platform layer to the focused widget.
event/config
Package config defines the event that reports an in-place configuration change to the mobile driver.
Package config defines the event that reports an in-place configuration change to the mobile driver.
event/key
Package key defines an event for physical keyboard keys.
Package key defines an event for physical keyboard keys.
event/lifecycle
Package lifecycle defines an event for an app's lifecycle.
Package lifecycle defines an event for an app's lifecycle.
event/paint
Package paint defines an event for the app being ready to paint.
Package paint defines an event for the app being ready to paint.
event/size
Package size defines an event for the dimensions, physical resolution and orientation of the app's window.
Package size defines an event for the dimensions, physical resolution and orientation of the app's window.
event/textedit
Package textedit defines the committed text-edit event used by the mobile driver to carry a native IME/keyboard edit — a range replacement — from the platform layer to the focused editor through the text-input mirror seam (#771).
Package textedit defines the committed text-edit event used by the mobile driver to carry a native IME/keyboard edit — a range replacement — from the platform layer to the focused editor through the text-input mirror seam (#771).
event/touch
Package touch defines an event for touch input.
Package touch defines an event for touch input.
event/undoredo
Package undoredo defines the native undo/redo invocation event used by the mobile driver to carry a platform-initiated undo or redo — the iPad soft keyboard's undo/redo bar keys, the three-finger swipe gestures or shake-to-undo, all of which drive the first responder's NSUndoManager — from the platform layer to the focused editor (#1134).
Package undoredo defines the native undo/redo invocation event used by the mobile driver to carry a platform-initiated undo or redo — the iPad soft keyboard's undo/redo bar keys, the three-finger swipe gestures or shake-to-undo, all of which drive the first responder's NSUndoManager — from the platform layer to the focused editor (#1134).
gl
Package gl implements Go bindings for OpenGL ES 2.0 and ES 3.0.
Package gl implements Go bindings for OpenGL ES 2.0 and ES 3.0.
mobileinit
Package mobileinit contains common initialization logic for mobile platforms that is relevant to both all-Go apps and gobind-based apps.
Package mobileinit contains common initialization logic for mobile platforms that is relevant to both all-Go apps and gobind-based apps.

Jump to

Keyboard shortcuts

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