wayland

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: BSD-3-Clause Imports: 29 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

Overview

Package wayland is the Wayland backend. It calls libwayland through purego and uses Go protocol bindings generated from protocols/*.xml.

Flutter: the Linux embedder (engine/src/flutter/shell/platform/linux).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Global

type Global struct {
	// Name is the numeric name that identifies the global in the registry.
	Name uint32
	// Version is the highest version of the interface the compositor offers.
	Version uint32
}

Global is one global object that the compositor announced.

Flutter: no counterpart

type Options

type Options struct {
	// ShmFill makes every window draw a solid color itself, through wl_shm, and
	// never call Handler.OnFrame. It is a development and test aid for
	// machines and tests without EGL (GLUTTER_DEV_SHM=1 in the dev examples).
	ShmFill bool
	// NoLibdecor stops the platform from loading libdecor: a window on a
	// compositor without server-side decorations then draws its own title bar. The
	// tests that run on a fake compositor use it, since libdecor needs a real one.
	NoLibdecor bool
}

Options configures a Platform.

Flutter: no counterpart

type Platform

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

Platform is the Wayland backend of platform.Platform. So far it has the connection, the event loop, windows and the outputs.

The settings come from the Settings portal (SPEC §8.8).

Flutter: no counterpart

func New

func New(name string, opts ...Options) (*Platform, error)

New connects to the compositor with the given socket name (empty means $WAYLAND_DISPLAY) and binds the required globals. It fails with LibraryLoadFailed when libwayland-client is missing, WaylandConnectFailed when there is no compositor, and WaylandProtocolMissing when the compositor lacks a required protocol. Close releases the connection.

Flutter: no counterpart

func (*Platform) Clipboard

func (p *Platform) Clipboard() platform.Clipboard

Clipboard returns the clipboard of the seat, or nil when the compositor has no wl_data_device_manager.

Flutter: no counterpart

func (*Platform) Close

func (p *Platform) Close() error

Close closes the windows that are still open, then releases the event loop and the connection. Do not use the platform afterwards, and do not call it while Run is active.

Flutter: no counterpart

func (*Platform) Displays

func (p *Platform) Displays() []platform.Display

Displays lists the outputs that are connected, in the order they were announced. The primary one is the one at the origin of the logical space, or the first.

Flutter: no counterpart

func (*Platform) Globals

func (p *Platform) Globals(iface string) ([]Global, bool)

Globals returns every global the compositor announced for an interface, such as "wl_output" or "wp_viewporter", and whether there was any.

Flutter: no counterpart

func (*Platform) NewWindow

func (p *Platform) NewWindow(cfg platform.WindowConfig) (platform.Window, error)

NewWindow creates a toplevel window and shows it. The window is mapped once the compositor has answered the first commit with a configure, which happens inside Run. The title and the app id are set before that first commit, so the compositor matches the window to the app's .desktop file.

Flutter: no counterpart

func (*Platform) Post

func (p *Platform) Post(fn func())

Post runs fn on the UI thread inside Run. It is safe from any goroutine and wakes the loop.

Flutter: no counterpart

func (*Platform) RequestActivationToken

func (p *Platform) RequestActivationToken(view ui.ViewID, done func(token string))

RequestActivationToken asks the compositor for an activation token for the window of the view, with the serial of the last input event of the seat and the app id of the window: the proof that a user action is behind it. done gets the token on the UI thread, or an empty token when there is no such window or the compositor has no xdg_activation_v1. The token goes to an app that this app starts, in XDG_ACTIVATION_TOKEN, or to activate a window of this app.

Flutter: no counterpart

func (*Platform) Run

func (p *Platform) Run(ctx context.Context, h platform.Handler) error

Run runs the event loop on the calling goroutine, which must be the UI thread, and delivers events to h. It returns nil when ctx is cancelled or when the last window has been closed, and the error of the connection when it fails: WaylandProtocolError (metadata "interface", "id", "code") when the compositor reports a protocol error, WaylandConnectionLost when the socket fails. A second call while Run is active fails with PlatformAlreadyRunning.

Flutter: no counterpart

func (*Platform) Services

func (p *Platform) Services() platform.Services

Services returns the services that the Linux backends share (the accessibility bridge).

Flutter: no counterpart

func (*Platform) Settings

func (p *Platform) Settings() platform.Settings

Settings returns the system settings: from the Settings portal, else from the environment (SPEC §8.8). The first call connects to the portal and starts following its changes, which arrive through Handler.OnSettings.

Flutter: no counterpart

type WindowStates

type WindowStates struct {
	// Maximized is whether the window fills the work area.
	Maximized bool
	// Fullscreen is whether the window fills the output.
	Fullscreen bool
	// Resizing is whether the user is resizing the window right now.
	Resizing bool
	// Activated is whether the window has keyboard focus.
	Activated bool
	// TiledLeft, TiledRight, TiledTop and TiledBottom say which edges touch
	// another window or the screen edge.
	TiledLeft, TiledRight, TiledTop, TiledBottom bool
	// Suspended is whether the compositor hides the window, so it should not
	// draw.
	Suspended bool
}

WindowStates holds the xdg_toplevel states the compositor last reported.

Flutter: no counterpart

Directories

Path Synopsis
Package decor binds libdecor, the library that draws native title bars for Wayland compositors without server-side decorations (GNOME).
Package decor binds libdecor, the library that draws native title bars for Wayland compositors without server-side decorations (GNOME).
Package fakecomp is a tiny fake Wayland compositor for tests: it speaks the wire protocol over a socket pair, answers the requests that the tests send, and logs them.
Package fakecomp is a tiny fake Wayland compositor for tests: it speaks the wire protocol over a socket pair, answers the requests that the tests send, and logs them.
Package wl is the Wayland client: the runtime over libwayland-client, which is bound with purego, and the Go bindings of every protocol in ../protocols, generated by `glutter-gen wayland` into the *_gen.go files.
Package wl is the Wayland client: the runtime over libwayland-client, which is bound with purego, and the Go bindings of every protocol in ../protocols, generated by `glutter-gen wayland` into the *_gen.go files.

Jump to

Keyboard shortcuts

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