Expand description
The installed window policy’s seat in the compositor: events out, commands applied.
The window policy’s seat in the compositor: what the frontend tells an installed
[WindowPolicy] and how its commands become Smithay state.
With no policy installed every call here is a no-op and the frontend keeps its own behavior.
Once one is (Compositor::install_window_policy), the frontend asks it at each decision
point through the functions below instead of forcing a window fullscreen, and this module
carries the answers out: a configure becomes an xdg configure and a Space mapping, a
stacking order a sequence of raises, a frame a set of memory render buffers drawn with the
window, an overlay one drawn over every output, an effect a transform the render tick
applies, a hidden window a Space unmapping that keeps the window for its return.
The policy runs inside the compositor’s handlers, so a panic in it would end the stream;
[dispatch] catches it, drops the policy, and puts every window back the way the frontend
shows them without one, logging the panic once, so a window-manager bug degrades the
desktop rather than ending the stream.
Window ids are the frontend’s WindowMeta ids, the ones the window list reports, so the
policy and the consumer name the same window the same way.
Structs§
- Frame
Buffers - A frame’s parts as render buffers, placed relative to the client area.
- Ghost
- The last picture of a window that is going away, kept so the policy’s close effect has something to shrink and fade once the client’s buffer is gone.
- Ghost
Elements - A ghost’s render elements: its picture as the renderer’s texture or as the copied buffer, and its frame parts.
- Overlay
- An overlay as a render buffer at a layout rectangle.
- Pending
Move - A move held until the toplevel commits a size, see
WmState::pending_moves. - WmState
- Everything the compositor keeps for an installed policy.
Enums§
- Ghost
Texture - What a ghost is drawn from: the renderer’s own texture of the surface where the renderer keeps one that outlives the client’s buffer (a GL texture, uploaded or bound to the dmabuf), else a copy of the shared-memory buffer taken while it was still attached, since a pixman texture reads the client’s memory and is unusable once the buffer is destroyed.
Constants§
- GHOST_
LIFETIME 🔒 - How long a ghost may live however the policy drives it.
- GHOST_
UNCLAIMED 🔒 - How long a ghost is kept waiting for the policy’s effect before it is dropped unseen.
Functions§
- activate_
desktop - A pager asked to switch to a virtual desktop, counted from zero.
- active
- Whether a policy is installed and alive.
- apply 🔒
- Carry one command out.
- buffer_
of 🔒 - configure 🔒
- Place and size a window as the policy asked: an xdg configure for the size and states, a Space mapping for the position, a Space unmapping for a minimized one or one on another desktop, and the output’s enter and leave as the window moves between outputs.
- copy_
shm 🔒 - A copy of a shared-memory buffer’s pixels as a render buffer,
Nonefor a buffer that is not shared memory or whose format the renderers do not take. - decorates
- The policy’s decoration choice for a window: whether it draws a frame, so the client is told the matching xdg-decoration mode.
- dispatch
- The policy’s decision about an event;
Passwith no policy. - effect_
of - The effect a window is presented through, if one runs.
- exclusive_
layer 🔒 - The layer surface on the top or overlay layer that asks for the keyboard exclusively (a shell’s open menu or launcher), if one does.
- find_
window - Every window the compositor has by id: shown, pending, or hidden.
- focused_
surface - The surface of the window the policy gave the keyboard to, if it is on the layout.
- frame_
elements - The render elements of a window’s frame around a client area at
client_loc(layout coordinates), for an output atoriginandscale. - frame_
elements_ through - The frame parts of a window through its effect: each placed and sized as the effect’s rectangle scales the client area, blended at its alpha.
- frame_
extents - The frame’s extents around a window, zero without one.
- ghost_
elements - The render elements of a ghost through its effect: the picture scaled from the client area it stood at into the effect’s rectangle and blended at its alpha, with the frame parts around it at the same scale. Nothing for a ghost without an effect.
- hit_
hidden - Whether a window is hidden from the compositor’s hit test: shaded or faded out.
- install
- Install a policy: it is told the outputs and every window already shown, so a window configured fullscreen before it came is placed the way it would have been.
- judged_
location - Where a button or a scroll is judged, and where a relative delta adds to: where the policy took the last motion while it keeps taking pointer events, else the seat’s pointer. The seat’s pointer follows a motion the policy takes only while no client holds a pointer grab, so with a client’s popup grab held a click on the policy’s menu would otherwise land where the pointer stood before the menu took it, and every delta of a frame drag, whose press grabs for the client, would start from where the drag began.
- key
- The policy’s verdict on a key, with the keysyms the seat’s keymap resolved.
- key_
filter - The keyboard filter the seat’s
inputtakes: the policy’s verdict as an intercept, with the keysyms the seat’s keymap resolved for the key. - mark_
dirty - Note that something the policy presents changed, so the captures render a frame.
- modifiers 🔒
- The modifiers the seat’s keyboard holds.
- move_
to_ 🔒output_ under - Keep the window’s output tag and its surface’s output enter and leave with the output the client rectangle mostly lies on.
- next_
wake - When the policy next wants a tick.
- outputs_
changed - Tell the policy the layout: every output with its workarea, when it differs from the last.
- overlay_
elements - The render elements of every overlay that touches an output at
originofsize(logical), topmost first. - pointer
- The policy’s verdict on a pointer event at a logical layout point. A taken event makes the clients see the pointer leave, so a frame drag never scrolls or clicks what lies under the frame, and still moves the seat’s pointer, since a button is judged at the seat’s location: a menu whose motion the policy took would otherwise see every click at the spot it opened on. Under a client’s grab the seat’s pointer is not moved, so the first event the policy passes after taking some brings it to where the policy last took the pointer: the release that ends a frame drag reaches the client there, and the next relative delta adds to the drag’s end rather than its start.
- rect_of
- The client rectangle the policy configured a window to.
- relocate 🔒
- Moves a mapped window to a location and keeps its place in the stacking: Smithay’s
Space::map_elementraises what it maps, so the windows that stood above this one are raised over it again in their order. A configure or a held move applied after the policy restacked (a cascade laid out over tiles, the tiles’ moves landing as their clients answer) would otherwise lift each moved window over the ones the policy stacked above it. A window mapped for the first time goes on top. - request
- A protocol request about a window.
- set_
decoration - Record what a client said about who decorates it, telling the policy where it knows the window.
- set_
frame 🔒 - set_
state 🔒 - shortcuts_
inhibited 🔒 - Whether the focused window holds an active shortcuts inhibitor, in which case every key is the client’s and the policy’s binds stand aside.
- show_
desktop - A shell asked to show or restore the desktop.
- snapshot
- Keep the last picture of a mapped window about to lose its buffer, with the frame it wears, so the policy’s close effect can shrink and fade it. Taken once per window: a client that attaches a null buffer and then destroys its toplevel is snapshotted on the first.
- states_
of - The states the policy configured a window to.
- sweep_
ghosts 🔒 - Drop the ghosts the policy never animated and the ones past their lifetime.
- sync_
decoration_ 🔒mode - Tell an xdg client the decoration mode the policy settled on: server-side where it draws a frame, client-side where the client wanted its own and none is drawn.
- sync_
layer_ keyboard - Give the keyboard to a layer surface that asks for it exclusively, or, once none does and a layer surface still holds it, back to the window the policy focused (the topmost window without a policy). Run when a layer surface commits or goes away, since that is when its keyboard interactivity changes; without it a shell’s menu or launcher on Wayland would never see a key.
- take_
dirty - Whether the policy’s presentation changed since the last call.
- taskbar_
rect - A taskbar said where it shows a window.
- tick
- Tick the policy; whether anything it presents changed.
- tick_
due - Whether the policy asked for a tick by
now. - under_
of - What the compositor’s hit test found, for the policy.
- uninstall 🔒
- Drop the policy and show every window the way the frontend does without one.
- view
- The desktop as the installed policy holds it, each window’s origin moved to its surface’s
corner;
Nonewith no policy, and after a panic in this call, which drops the policy as one indispatchdoes. - window_
added - Tell the policy about a window waiting for its first configure.
- window_
changed - Tell the policy a window’s details changed.
- window_
id 🔒 - window_
id_ 🔒of_ surface - window_
info - What the policy is told about a window.
- window_
mapped - The window drew its first buffer: it is on screen at this size.
- window_
removed - The window is gone.
- window_
resized - A mapped window committed a size. The policy is told when it differs from the last, and also when the commit answers a configure with a size other than the one asked for, which a client snapping to its cell size does without changing size at all; a move held for the configure is carried out on that answer, with whatever size the client chose.
- window_
unmapped - The client withdrew its window.
- x11_
display - Tell the policy an X server is up for its X11 clients.