forked from joejulian/gio
679a34b116
Wayland doesn't guarantee the presence of server-side window decorations (border, close/maximize/minimize buttons), and Gio doesn't have client-side decorations either (issue #29). The issue is more than a year old, so it's time to default to X11 to have a good out-of-the-box experience on unix systems. Updates gio#29 Signed-off-by: Elias Naur <mail@eliasnaur.com>
40 lines
787 B
Go
40 lines
787 B
Go
// SPDX-License-Identifier: Unlicense OR MIT
|
|
|
|
// +build linux,!android freebsd openbsd
|
|
|
|
package window
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
func Main() {
|
|
select {}
|
|
}
|
|
|
|
type windowDriver func(Callbacks, *Options) error
|
|
|
|
// 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 windowDriver
|
|
|
|
func NewWindow(window Callbacks, opts *Options) error {
|
|
var errFirst error
|
|
for _, d := range []windowDriver{x11Driver, wlDriver} {
|
|
if d == nil {
|
|
continue
|
|
}
|
|
err := d(window, opts)
|
|
if err == nil {
|
|
return nil
|
|
}
|
|
if errFirst == nil {
|
|
errFirst = err
|
|
}
|
|
}
|
|
if errFirst != nil {
|
|
return errFirst
|
|
}
|
|
return errors.New("app: no window driver available")
|
|
}
|