detached 2f7d458

fix(wayland): allow bufferless commits before get_layer_surface

commit
2f7d458d13c281540533ed405bdc989a02feac97
author
brice · · 2026-09-23 16:22 UTC
parent
c2ef3a9
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +2 -8
M internal/adapters/wayland/layer.go +1 -1
@@ -42,7 +42,7 @@ func (h layerShell) GetLayerSurface(r *wlrlayershell.ZwlrLayerShellV1, id uint32
4242 return
4343 }
4444 state := h.server.surfaces[w.Resource]
45- if state.kind != roleNone || state.attached || state.current != nil || state.committed {
45+ if state.kind != roleNone || (state.attached && state.pending != nil) || state.current != nil {
4646 r.PostError(uint32(wlrlayershell.ZwlrLayerShellV1ErrorAlreadyConstructed), "surface already constructed")
4747 return
4848 }
@@ -42,7 +42,7 @@ func (h layerShell) GetLayerSurface(r *wlrlayershell.ZwlrLayerShellV1, id uint32
42 return42 return
43 }43 }
44 state := h.server.surfaces[w.Resource]44 state := h.server.surfaces[w.Resource]
45- if state.kind != roleNone || state.attached || state.current != nil || state.committed {45+ if state.kind != roleNone || (state.attached && state.pending != nil) || state.current != nil {
46 r.PostError(uint32(wlrlayershell.ZwlrLayerShellV1ErrorAlreadyConstructed), "surface already constructed")46 r.PostError(uint32(wlrlayershell.ZwlrLayerShellV1ErrorAlreadyConstructed), "surface already constructed")
47 return47 return
48 }48 }
M internal/adapters/wayland/layer_test.go +1 -5
@@ -143,7 +143,7 @@ func TestWaybarLayer(t *testing.T) {
143143 }
144144
145145 func TestLayerAlreadyConstructed(t *testing.T) {
146- for _, scenario := range []string{"role", "attached", "committed"} {
146+ for _, scenario := range []string{"role"} {
147147 t.Run(scenario, func(t *testing.T) {
148148 s, _, _, dir := lifecycleServer(t)
149149 c := protocolClient(t, s, dir)
@@ -160,10 +160,6 @@ func TestLayerAlreadyConstructed(t *testing.T) {
160160 registerProtocol(t, c, parent)
161161 id := c.AllocateID()
162162 requestProtocol(t, c, sub, wayland.SubcompositorRequestGetSubsurface, id, surf, parent)
163- case "attached":
164- requestProtocol(t, c, surf, wayland.SurfaceRequestAttach, uint32(0), int32(0), int32(0))
165- case "committed":
166- requestProtocol(t, c, surf, wayland.SurfaceRequestCommit)
167163 }
168164 id := c.AllocateID()
169165 requestProtocol(t, c, shell, wlrlayershell.ZwlrLayerShellV1RequestGetLayerSurface, id, surf, uint32(0), uint32(ports.LayerTop), "test")
@@ -143,7 +143,7 @@ func TestWaybarLayer(t *testing.T) {
143 }143 }
144 144
145 func TestLayerAlreadyConstructed(t *testing.T) {145 func TestLayerAlreadyConstructed(t *testing.T) {
146- for _, scenario := range []string{"role", "attached", "committed"} {146+ for _, scenario := range []string{"role"} {
147 t.Run(scenario, func(t *testing.T) {147 t.Run(scenario, func(t *testing.T) {
148 s, _, _, dir := lifecycleServer(t)148 s, _, _, dir := lifecycleServer(t)
149 c := protocolClient(t, s, dir)149 c := protocolClient(t, s, dir)
@@ -160,10 +160,6 @@ func TestLayerAlreadyConstructed(t *testing.T) {
160 registerProtocol(t, c, parent)160 registerProtocol(t, c, parent)
161 id := c.AllocateID()161 id := c.AllocateID()
162 requestProtocol(t, c, sub, wayland.SubcompositorRequestGetSubsurface, id, surf, parent)162 requestProtocol(t, c, sub, wayland.SubcompositorRequestGetSubsurface, id, surf, parent)
163- case "attached":
164- requestProtocol(t, c, surf, wayland.SurfaceRequestAttach, uint32(0), int32(0), int32(0))
165- case "committed":
166- requestProtocol(t, c, surf, wayland.SurfaceRequestCommit)
167 }163 }
168 id := c.AllocateID()164 id := c.AllocateID()
169 requestProtocol(t, c, shell, wlrlayershell.ZwlrLayerShellV1RequestGetLayerSurface, id, surf, uint32(0), uint32(ports.LayerTop), "test")165 requestProtocol(t, c, shell, wlrlayershell.ZwlrLayerShellV1RequestGetLayerSurface, id, surf, uint32(0), uint32(ports.LayerTop), "test")
M internal/adapters/wayland/surface.go +0 -2
@@ -23,7 +23,6 @@ type surface struct {
2323 server *Server
2424 current, pending *wayland.Buffer
2525 attached bool
26- committed bool
2726 callbacks []*wayland.Callback
2827 role func(bool)
2928 destroyed bool
@@ -52,7 +51,6 @@ func (s *surface) Frame(r *wayland.Surface, id uint32) {
5251 }
5352 }
5453 func (s *surface) Commit(*wayland.Surface) {
55- s.committed = true
5654 fresh := s.attached && s.pending != nil
5755 if s.layer != nil && s.attached && s.pending != nil && !s.layer.acked {
5856 s.layer.resource.PostError(uint32(wlrlayershell.ZwlrLayerSurfaceV1ErrorInvalidSurfaceState), "buffer before configure ack")
@@ -23,7 +23,6 @@ type surface struct {
23 server *Server23 server *Server
24 current, pending *wayland.Buffer24 current, pending *wayland.Buffer
25 attached bool25 attached bool
26- committed bool
27 callbacks []*wayland.Callback26 callbacks []*wayland.Callback
28 role func(bool)27 role func(bool)
29 destroyed bool28 destroyed bool
@@ -52,7 +51,6 @@ func (s *surface) Frame(r *wayland.Surface, id uint32) {
52 }51 }
53 }52 }
54 func (s *surface) Commit(*wayland.Surface) {53 func (s *surface) Commit(*wayland.Surface) {
55- s.committed = true
56 fresh := s.attached && s.pending != nil54 fresh := s.attached && s.pending != nil
57 if s.layer != nil && s.attached && s.pending != nil && !s.layer.acked {55 if s.layer != nil && s.attached && s.pending != nil && !s.layer.acked {
58 s.layer.resource.PostError(uint32(wlrlayershell.ZwlrLayerSurfaceV1ErrorInvalidSurfaceState), "buffer before configure ack")56 s.layer.resource.PostError(uint32(wlrlayershell.ZwlrLayerSurfaceV1ErrorInvalidSurfaceState), "buffer before configure ack")

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 26

Tags 10

↑↓ moveenter openesc close