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
- type Options
- type Platform
- func (p *Platform) Clipboard() platform.Clipboard
- func (p *Platform) Close() error
- func (p *Platform) Displays() []platform.Display
- func (p *Platform) NewWindow(cfg platform.WindowConfig) (platform.Window, error)
- func (p *Platform) Post(fn func())
- func (p *Platform) Run(ctx context.Context, h platform.Handler) error
- func (p *Platform) Services() platform.Services
- func (p *Platform) Settings() platform.Settings
Constants ¶
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 ¶
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) Close ¶
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 ¶
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 ¶
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 ¶
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 ¶
Services returns the services that the Linux backends share (the accessibility bridge).
Flutter: no counterpart