Skip to main content

Module wm

Module wm 

Source
Expand description

The window policy interface a window manager implements for the compositor. The window policy interface: what a window manager decides for the compositor.

The capture compositor (wayland::frontend) owns the protocol state of every window and renders what is on each output; it decides nothing about where a window goes, which one has focus, or what a key chord means. Those decisions belong to a [WindowPolicy] installed through crate::Compositor::install_window_policy: the compositor hands it an [Event] at each decision point and applies the [Command]s it answers with. Without a policy the compositor keeps its own behavior, every window fullscreen on its output and no frame drawn, so a session that nests another compositor or runs one application is exactly what it was.

The interface is deliberately free of Smithay types: a window is a [WindowId], geometry an integer [Rect] in the compositor’s logical layout coordinates, and a frame or a menu a raster [Image] the policy drew and the compositor presents, so the same policy drives an X11 server through another backend with the same model. Images are premultiplied RGBA in physical pixels at the output’s scale, the format both tiny-skia produces and the renderers import without conversion.

The policy runs on the compositor thread, inside the handlers that call it, so it must never block; a long task (a pipe menu’s command) is run on a thread of its own and its result applied on a later event. A panic in the policy is caught at the boundary (frontend::AppState::policy): the compositor drops the policy, logs the panic, and carries on with its own behavior, so a window-manager bug degrades the desktop rather than ending the stream.

Structs§

DesktopView
The desktop as the policy holds it at one moment: what a consumer needs to say where every window is and which one a click at a point reaches.
Extents
The thickness of a frame around a client area, in logical pixels.
Frame
A window’s server-side frame: the border it adds around the client area and the parts that paint it. The compositor hit-tests nothing here; the policy keeps its own map of what a point on the frame means.
FramePart
One drawn part of a window’s frame, placed relative to the client area’s top-left corner.
Image
A raster the policy drew: premultiplied RGBA, width * 4 bytes a row, in physical pixels at scale logical pixels to one.
KeyEvent
One key event, already resolved through the seat’s keymap.
Modifiers
The modifiers held with a key or a button.
OutputInfo
One output of the layout.
PointerEvent
One pointer event in logical layout coordinates.
Rect
An integer rectangle in logical layout coordinates.
Size
A size in logical pixels.
SizeHints
Size constraints a client published (WM_NORMAL_HINTS, xdg min and max size).
States
The xdg states a configure carries, which the compositor also publishes to taskbars.
Transform
A per-frame transform an effect applies to a window as it is presented: the client area is drawn at rect instead of its configured geometry, which scales it, blended at alpha, and its frame parts follow it at the same scale. A Close transform names a window the compositor no longer has: it applies to the ghost the compositor kept of it, and the ghost is dropped when the transform is cleared.
Under
What the compositor found under the pointer, for the policy’s own hit test to combine with: a layer surface on the top or overlay layers takes the pointer ahead of every window and its frame, a window’s client area stands below the policy’s frames and menus.
WindowInfo
Everything the policy knows about a window, sent when it appears and again when any of it changes.
WindowView
One window as the policy holds it, for a consumer that describes the desktop.

Enums§

Command
What the policy tells the compositor to do.
Decoration
What a client said about who decorates it.
EffectKind
What an effect is for, so a backend that cannot scale a live window (an X server) still knows what to show: a minimize or a restore moves the empty frame, a map, a resize, or a close shows the window as it stands, a shade hides the client under its title bar.
Event
A decision point the compositor hands the policy.
PointerKind
What the pointer did.
Request
A request a client or a shell made of its window through a protocol.
ResizeEdge
One edge or corner a resize pulls, in xdg-shell’s numbering.
Verdict
What a policy decides about an input event.
WindowKind
The protocol a window arrived through.
WindowType
What a window is for, from _NET_WM_WINDOW_TYPE or the xdg role.

Constants§

EFFECT_FRAME
The interval between effect frames when no capture paces them: a frame at 60 Hz.

Traits§

WindowPolicy
A window manager’s decisions for the compositor; see the module documentation.

Type Aliases§

OutputId
The display id of an output, the key the consumer addresses displays by.
WindowId
The compositor’s stable numeric id of a window, the one its window list reports.