x11

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: BSD-3-Clause Imports: 26 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 x11 is the X11 backend. It calls Xlib and XInput2 through purego.

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

Index

Constants

View Source
const NoSHMEnv = "GLUTTER_X11_NOSHM"

NoSHMEnv is the variable that turns MIT-SHM off, so that the pixels go with XPutImage. It is a debug aid, for the display tests and for finding out whether the extension is at fault.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// PixelWindows says that the windows are drawn by the software renderer, which sends pixels
	// (gpu.PixelTarget): they get a 24-bit TrueColor visual of their own choice and EGL is not
	// asked for one, so the library is not loaded and the display is not initialized for it.
	// Without it a window takes the visual that EGL wants, and shows pixels when that visual's
	// layout allows.
	PixelWindows bool
}

Options are the optional parameters of New.

Flutter: no counterpart

type Platform

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

Platform is the X11 backend of platform.Platform: Xlib and XInput2 through purego, with EGL for drawing (SPEC §8.3). It belongs to the UI thread.

Flutter: no counterpart

func New

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

New connects to the X server named by name (empty means $DISPLAY) and sets up the keyboard and pointer input. It fails with LibraryLoadFailed when libX11 is missing and X11OpenDisplayFailed when the display cannot be opened. Without libXi or without XInput2 on the server there is no keyboard and pointer input (a warning is logged). Close releases the connection. More than one options value panics with MultipleOptions.

Flutter: no counterpart

func (*Platform) Clipboard

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

Clipboard returns the CLIPBOARD selection.

Flutter: no counterpart

func (*Platform) Close

func (p *Platform) Close() error

Close closes the windows that are still open 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 monitors, the primary one marked. A monitor is placed and sized in logical pixels, by its own scale.

Flutter: no counterpart

func (*Platform) NewWindow

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

NewWindow creates a toplevel window and maps it. The window is visible once the window manager has handled the map request, which happens inside Run: the first frame is then requested from the handler.

The window uses the X visual that EGL wants for its config, so that the renderer can draw into it (gles.X11Visual); when EGL is not usable the window uses the default visual and the renderer's Open will report the failure.

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) 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. 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 XSETTINGS and 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

Jump to

Keyboard shortcuts

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