You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: internal/adapter/platform/linux/AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
Read `../AGENTS.md` first (slots, factory, stubs, generated `wlr_protocol/`). This file covers what it omits. These rules are scattered across file-head comments; violating them fails at link or run time, not compile time.
4
4
5
5
-**Backend selection is runtime, not build-tag**: KDE and wlroots are identical at compile time (`linux && wayland`); dispatch on `platform.DetectLinuxBackend`, never add a compositor build tag.
6
-
-**Every cgo symbol has a `_nocgo.go` twin** returning `derrors.CodeNotSupported` ("requires CGO-enabled Linux builds"); pinned by `system_stub_contract_test.go` — a supported capability must never answer `CodeNotSupported` or return nil. The one exception, on both backends, is a query that worked and found nothing: `FocusedApplicationPID` reports `CodeNotSupported` when no window is focused, so callers degrade instead of surfacing a live desktop as a failure. It is not a gap, and the capability is live-probed rather than declared, so the guardrail sees the two move together.
6
+
-**Every cgo symbol has a `_nocgo.go` twin** returning `derrors.CodeNotSupported` ("requires CGO-enabled Linux builds"); pinned by `system_stub_contract_test.go` — a supported capability must never answer `CodeNotSupported` or return nil. The exceptions, on both backends, are the queries that worked and found nothing: `FocusedApplicationPID` reports `CodeNotSupported` when no window is focused, and again when the window that is focused publishes no pid (`_NET_WM_PID` is a convention EWMH does not require), so callers degrade instead of surfacing a live desktop as a failure. Each wears its own sentinel — `errNoFocusedWindow`, `errNoWindowPID` — because `neru doctor` explains them in different words, and a failure must wear neither. They are not gaps, and the capability is live-probed rather than declared, so the guardrail sees the two move together.
7
7
-**The `.c` files compile in exactly one unit** (`cgo.go`). Packages that call bridge symbols must blank-import `platform/linux` — and `wlr_protocol` separately — or the linker fails with undefined symbols.
8
8
-**Xlib protocol errors go through the one shared trap** (`x11_error_trap.h`), never a second `XSetErrorHandler`. The default handler calls `exit()`, so any request that can legitimately fail — reading pixels off a drawable that shrank, reading a property off a window whose client just died — has to be trapped; and the handler is process-global, so two traps under two mutexes would interleave and leave one caller's requests running under the handler that exits. Keep trapped sections short: everything else that traps waits behind them.
9
9
-**`doc.go` is tagged `linux`, not `linux && cgo` — deliberately.** The `.c` files already gate cgo builds; the broader tag keeps analysis working on other hosts. Don't "fix" it.
0 commit comments