mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +00:00
bdc2f3f4e8
A Window configuration with its current option values can now be fetched during a FrameEvent. The WindowMode and Orientation options have moved to methods on their corresponding types. Fixes #260 Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
51 lines
1.1 KiB
Go
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, []Option) 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, options []Option) error {
|
|
var errFirst error
|
|
for _, d := range []windowDriver{x11Driver, wlDriver} {
|
|
if d == nil {
|
|
continue
|
|
}
|
|
err := d(window, options)
|
|
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() {}
|