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 ¶
- type Global
- type Options
- type Platform
- func (p *Platform) Clipboard() platform.Clipboard
- func (p *Platform) Close() error
- func (p *Platform) Displays() []platform.Display
- func (p *Platform) Globals(iface string) ([]Global, bool)
- func (p *Platform) NewWindow(cfg platform.WindowConfig) (platform.Window, error)
- func (p *Platform) Post(fn func())
- func (p *Platform) RequestActivationToken(view ui.ViewID, done func(token string))
- func (p *Platform) Run(ctx context.Context, h platform.Handler) error
- func (p *Platform) Services() platform.Services
- func (p *Platform) Settings() platform.Settings
- type WindowStates
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 ¶
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 ¶
Clipboard returns the clipboard of the seat, or nil when the compositor has no wl_data_device_manager.
Flutter: no counterpart
func (*Platform) Close ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Services returns the services that the Linux backends share (the accessibility bridge).
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
Source Files
¶
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. |