github.com/gop9/olt@v0.0.0-20200202132135-d956aad50b08/gio/app/internal/window/os_unix.go (about) 1 // SPDX-License-Identifier: Unlicense OR MIT 2 3 // +build linux,!android freebsd 4 5 package window 6 7 import ( 8 "errors" 9 ) 10 11 var mainDone = make(chan struct{}) 12 13 func Main() { 14 <-mainDone 15 } 16 17 // instead of creating files with build tags for each combination of wayland +/- x11 18 // let each driver initialize these variables with their own version of createWindow. 19 var wlDriver, x11Driver func(Callbacks, *Options) error 20 21 func NewWindow(window Callbacks, opts *Options) error { 22 var errFirst, err error 23 if wlDriver != nil { 24 if err = wlDriver(window, opts); err == nil { 25 return nil 26 } 27 errFirst = err 28 } 29 if x11Driver != nil { 30 if err = x11Driver(window, opts); err == nil { 31 return nil 32 } 33 if errFirst == nil { 34 errFirst = err 35 } 36 } 37 if errFirst != nil { 38 return errFirst 39 } 40 return errors.New("app: no window driver available") 41 }