feat(ports): add layer surface messages and scene layers
- commit
- ffa1efa963dfd74b3bfb55a9c0411dc60705805e
- author
- brice · · 2026-09-23 16:06 UTC
- parent
- e930e7f
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +47 -0
M internal/ports/messages.go +47 -0
| @@ -24,6 +24,43 @@ type WindowFullscreenRequest struct { | |||
| 24 | 24 | ||
| 25 | 25 | func (WindowFullscreenRequest) clientEvent() {} | |
| 26 | 26 | ||
| 27 | + | // Layer is a wlr-layer-shell stacking layer. | |
| 28 | + | type Layer uint32 | |
| 29 | + | ||
| 30 | + | const ( | |
| 31 | + | LayerBackground Layer = iota | |
| 32 | + | LayerBottom | |
| 33 | + | LayerTop | |
| 34 | + | LayerOverlay | |
| 35 | + | ) | |
| 36 | + | ||
| 37 | + | // Anchor edges, as in zwlr_layer_surface_v1.anchor. | |
| 38 | + | const ( | |
| 39 | + | AnchorTop uint32 = 1 | |
| 40 | + | AnchorBottom uint32 = 2 | |
| 41 | + | AnchorLeft uint32 = 4 | |
| 42 | + | AnchorRight uint32 = 8 | |
| 43 | + | ) | |
| 44 | + | ||
| 45 | + | // LayerSurface is the committed state of one mapped layer surface. Width and | |
| 46 | + | // Height are the committed buffer size. Margin is top, right, bottom, left. | |
| 47 | + | // IDs share the WindowID space with windows and never collide. | |
| 48 | + | type LayerSurface struct { | |
| 49 | + | ID WindowID | |
| 50 | + | Layer Layer | |
| 51 | + | Anchor uint32 | |
| 52 | + | ExclusiveZone int32 | |
| 53 | + | Margin [4]int32 | |
| 54 | + | Width, Height int | |
| 55 | + | Namespace string | |
| 56 | + | } | |
| 57 | + | ||
| 58 | + | // LayerChanged carries wayland → core the full list of mapped layer surfaces, | |
| 59 | + | // sent whenever a layer surface maps, unmaps or commits new layer state. | |
| 60 | + | type LayerChanged struct{ Layers []LayerSurface } | |
| 61 | + | ||
| 62 | + | func (LayerChanged) clientEvent() {} | |
| 63 | + | ||
| 27 | 64 | // Mods carries input → core modifier flags. | |
| 28 | 65 | type Mods uint8 | |
| 29 | 66 | ||
| @@ -151,6 +188,16 @@ type Scene struct { | |||
| 151 | 188 | OutputWidth, OutputHeight int | |
| 152 | 189 | Background string | |
| 153 | 190 | Windows []SceneWindow | |
| 191 | + | // Layers are drawn in slice order: background and bottom before windows, | |
| 192 | + | // top and overlay after. A fullscreen window covers bottom and top. | |
| 193 | + | Layers []SceneLayer | |
| 194 | + | } | |
| 195 | + | ||
| 196 | + | // SceneLayer carries core → renderer layer surface placement. | |
| 197 | + | type SceneLayer struct { | |
| 198 | + | ID WindowID | |
| 199 | + | Layer Layer | |
| 200 | + | Rect Rect | |
| 154 | 201 | } | |
| 155 | 202 | ||
| 156 | 203 | // SurfaceContent carries wayland → output the latest committed pixels of a | |
| @@ -24,6 +24,43 @@ type WindowFullscreenRequest struct { | |||||
| 24 | 24 | ||||
| 25 | func (WindowFullscreenRequest) clientEvent() {} | 25 | func (WindowFullscreenRequest) clientEvent() {} | ||
| 26 | 26 | ||||
| 27 | + | // Layer is a wlr-layer-shell stacking layer. | |||
| 28 | + | type Layer uint32 | |||
| 29 | + | ||||
| 30 | + | const ( | |||
| 31 | + | LayerBackground Layer = iota | |||
| 32 | + | LayerBottom | |||
| 33 | + | LayerTop | |||
| 34 | + | LayerOverlay | |||
| 35 | + | ) | |||
| 36 | + | ||||
| 37 | + | // Anchor edges, as in zwlr_layer_surface_v1.anchor. | |||
| 38 | + | const ( | |||
| 39 | + | AnchorTop uint32 = 1 | |||
| 40 | + | AnchorBottom uint32 = 2 | |||
| 41 | + | AnchorLeft uint32 = 4 | |||
| 42 | + | AnchorRight uint32 = 8 | |||
| 43 | + | ) | |||
| 44 | + | ||||
| 45 | + | // LayerSurface is the committed state of one mapped layer surface. Width and | |||
| 46 | + | // Height are the committed buffer size. Margin is top, right, bottom, left. | |||
| 47 | + | // IDs share the WindowID space with windows and never collide. | |||
| 48 | + | type LayerSurface struct { | |||
| 49 | + | ID WindowID | |||
| 50 | + | Layer Layer | |||
| 51 | + | Anchor uint32 | |||
| 52 | + | ExclusiveZone int32 | |||
| 53 | + | Margin [4]int32 | |||
| 54 | + | Width, Height int | |||
| 55 | + | Namespace string | |||
| 56 | + | } | |||
| 57 | + | ||||
| 58 | + | // LayerChanged carries wayland → core the full list of mapped layer surfaces, | |||
| 59 | + | // sent whenever a layer surface maps, unmaps or commits new layer state. | |||
| 60 | + | type LayerChanged struct{ Layers []LayerSurface } | |||
| 61 | + | ||||
| 62 | + | func (LayerChanged) clientEvent() {} | |||
| 63 | + | ||||
| 27 | // Mods carries input → core modifier flags. | 64 | // Mods carries input → core modifier flags. | ||
| 28 | type Mods uint8 | 65 | type Mods uint8 | ||
| 29 | 66 | ||||
| @@ -151,6 +188,16 @@ type Scene struct { | |||||
| 151 | OutputWidth, OutputHeight int | 188 | OutputWidth, OutputHeight int | ||
| 152 | Background string | 189 | Background string | ||
| 153 | Windows []SceneWindow | 190 | Windows []SceneWindow | ||
| 191 | + | // Layers are drawn in slice order: background and bottom before windows, | |||
| 192 | + | // top and overlay after. A fullscreen window covers bottom and top. | |||
| 193 | + | Layers []SceneLayer | |||
| 194 | + | } | |||
| 195 | + | ||||
| 196 | + | // SceneLayer carries core → renderer layer surface placement. | |||
| 197 | + | type SceneLayer struct { | |||
| 198 | + | ID WindowID | |||
| 199 | + | Layer Layer | |||
| 200 | + | Rect Rect | |||
| 154 | } | 201 | } | ||
| 155 | 202 | ||||
| 156 | // SurfaceContent carries wayland → output the latest committed pixels of a | 203 | // SurfaceContent carries wayland → output the latest committed pixels of a | ||