Files
gio-patched/app/os_unix.go
T
Elias Naur 45da52cee7 app: merge app/internal/wm into package app
The app and app/internal/wm packages are tightly coupled, requiring
quite a bit of forwarding types, values and constants from the internal
package to export it. Further, no other package imports package wm.

This change merges the two packages.

While here, drop the pre-Go 1.14 SIGPIPE workaround.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-08-29 22:00:16 +02:00

51 lines
1.1 KiB
Go

// SPDX-License-Identifier: Unlicense OR MIT
//go:build (linux && !android) || freebsd || openbsd
// +build linux,!android freebsd openbsd
package app
import (
"errors"
"unsafe"
)
type ViewEvent struct {
// Display is a pointer to the X11 Display created by XOpenDisplay.
Display unsafe.Pointer
// Window is the X11 window ID as returned by XCreateWindow.
Window uintptr
}
func osMain() {
select {}
}
type windowDriver func(*callbacks, *config) 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, cnf *config) error {
var errFirst error
for _, d := range []windowDriver{x11Driver, wlDriver} {
if d == nil {
continue
}
err := d(window, cnf)
if err == nil {
return nil
}
if errFirst == nil {
errFirst = err
}
}
if errFirst != nil {
return errFirst
}
return errors.New("app: no window driver available")
}
func (_ ViewEvent) ImplementsEvent() {}