Refactor errors

This commit is contained in:
Unrud 2023-04-25 01:38:48 +02:00
parent 91a37de0fb
commit 891fde7051
5 changed files with 43 additions and 35 deletions

View file

@ -61,13 +61,13 @@ func init() {
func InitX11Controller() (Controller, error) {
display := C.XOpenDisplay(nil)
if display == nil {
return nil, UnsupportedPlatformError{
return nil, &UnsupportedPlatformError{
errors.New("failed to connect to X server")}
}
p := &x11Controller{display: display}
if p.xIsXwayland() {
p.Close()
return nil, UnsupportedPlatformError{
return nil, &UnsupportedPlatformError{
errors.New("X server is Xwayland")}
}
return p, nil