~eliasnaur/gio

Mailing list for the Gio project for discussion and patches.

Send your message to ~eliasnaur/gio@lists.sr.ht. No account is required and you can post without being subscribed.

[PATCH 1/6] ui/app: (wayland) return a specific error value when connection fails

Details
Message ID
<CACwxszbJ2xWY4m0C2R6u6CGRwck3Kc7WQXSPJeSc8WsBXFUDUw@mail.gmail.com>
DKIM signature
pass
Download raw message
Returning specific error will help the high-level code fallback from
Wayland to X11 code path.

Signed-off-by: Denys Smirnov <denis.smirnov.91@gmail.com>
---
 ui/app/os_wayland.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ui/app/os_wayland.go b/ui/app/os_wayland.go
index 571e8f2..5f8d654 100644
--- a/ui/app/os_wayland.go
+++ b/ui/app/os_wayland.go
@@ -54,6 +54,8 @@ import (
 */
 import "C"

+var errWLDisplayConnectFailed = errors.New("wayland:
wl_display_connect failed")
+
 type wlConn struct {
   disp         *C.struct_wl_display
   compositor   *C.struct_wl_compositor
@@ -1110,7 +1112,7 @@ func waylandConnect() error {
   c.disp = C.wl_display_connect(nil)
   if c.disp == nil {
      c.destroy()
-     return errors.New("wayland: wl_display_connect failed")
+     return errWLDisplayConnectFailed
   }
   reg := C.wl_display_get_registry(c.disp)
   if reg == nil {
-- 
2.20.1