mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 01:15:35 +00:00
app/internal/window: x11 driver
This driver still lacks fling support and dp/sp configuration. By default, linux builds will try to use the Wayland driver then fallback to X11 if it fails. Drivers can be disabled by using either the nowayland or nox11 build tags. Signed-off-by: Denis Bernard <db047h@gmail.com>
This commit is contained in:
committed by
Elias Naur
parent
ec672ca06a
commit
547ff2e484
@@ -0,0 +1,41 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
// +build linux,!android
|
||||
|
||||
package window
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
var mainDone = make(chan struct{})
|
||||
|
||||
func Main() {
|
||||
<-mainDone
|
||||
}
|
||||
|
||||
// instead of creating files with build tags for each combination of wayland +/- x11
|
||||
// let each driver initialize these variables with their own version of createWindow.
|
||||
var wlDriver, x11Driver func(Callbacks, *Options) error
|
||||
|
||||
func NewWindow(window Callbacks, opts *Options) error {
|
||||
var errFirst, err error
|
||||
if wlDriver != nil {
|
||||
if err = wlDriver(window, opts); err == nil {
|
||||
return nil
|
||||
}
|
||||
errFirst = err
|
||||
}
|
||||
if x11Driver != nil {
|
||||
if err = x11Driver(window, opts); err == nil {
|
||||
return nil
|
||||
}
|
||||
if errFirst == nil {
|
||||
errFirst = err
|
||||
}
|
||||
}
|
||||
if errFirst != nil {
|
||||
return errFirst
|
||||
}
|
||||
return errors.New("app: no window driver available")
|
||||
}
|
||||
Reference in New Issue
Block a user