internal/wayland: reimplement connect/bind code
All checks were successful
Test / Create distribution (push) Successful in 36s
Test / Sandbox (push) Successful in 2m13s
Test / Hakurei (push) Successful in 3m18s
Test / Hpkg (push) Successful in 4m9s
Test / Sandbox (race detector) (push) Successful in 4m14s
Test / Hakurei (race detector) (push) Successful in 5m7s
Test / Flake checks (push) Successful in 1m26s
All checks were successful
Test / Create distribution (push) Successful in 36s
Test / Sandbox (push) Successful in 2m13s
Test / Hakurei (push) Successful in 3m18s
Test / Hpkg (push) Successful in 4m9s
Test / Sandbox (race detector) (push) Successful in 4m14s
Test / Hakurei (race detector) (push) Successful in 5m7s
Test / Flake checks (push) Successful in 1m26s
The old implementation is relocated to system/wayland/deprecated.go. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -31,10 +31,10 @@ const (
|
||||
)
|
||||
|
||||
type (
|
||||
// Res is the outcome of a call to hakurei_bind_wayland_fd.
|
||||
// Res is the outcome of a call to [New].
|
||||
Res = C.hakurei_wayland_res
|
||||
|
||||
// An Error represents a failure during hakurei_bind_wayland_fd.
|
||||
// An Error represents a failure during [New].
|
||||
Error struct {
|
||||
// Where the failure occurred.
|
||||
Cause Res
|
||||
@@ -68,6 +68,13 @@ const (
|
||||
RBind Res = C.HAKUREI_WAYLAND_BIND
|
||||
// RListen is returned if listen failed. The global errno is set.
|
||||
RListen Res = C.HAKUREI_WAYLAND_LISTEN
|
||||
|
||||
// RHostCreate is returned if ensuring pathname availability failed. Returned by [New].
|
||||
RHostCreate Res = C.HAKUREI_WAYLAND_HOST_CREAT
|
||||
// RHostSocket is returned if socket failed for host server. Returned by [New].
|
||||
RHostSocket Res = C.HAKUREI_WAYLAND_HOST_SOCKET
|
||||
// RHostConnect is returned if connect failed for host server. Returned by [New].
|
||||
RHostConnect Res = C.HAKUREI_WAYLAND_HOST_CONNECT
|
||||
)
|
||||
|
||||
func (e *Error) Unwrap() error { return e.Errno }
|
||||
@@ -95,6 +102,16 @@ func (e *Error) Error() string {
|
||||
}
|
||||
return e.Errno.Error()
|
||||
|
||||
case RHostCreate:
|
||||
if e.Errno == nil {
|
||||
return "cannot ensure wayland pathname socket"
|
||||
}
|
||||
return e.Errno.Error()
|
||||
case RHostSocket:
|
||||
return e.withPrefix("socket for host wayland server")
|
||||
case RHostConnect:
|
||||
return e.withPrefix("connect to host wayland server")
|
||||
|
||||
default:
|
||||
return e.withPrefix("impossible outcome") /* not reached */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user