mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
app,io/system: extract system events to separate package
Package app is the only package that depends on native libraries and Cgo. Minimize its API, thereby minimizing Gio clients' dependency on it. In the future, a headless, testing or remote "Window" should be very easy to replace app.Window. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+3
-12
@@ -4,9 +4,9 @@ package layout
|
||||
|
||||
import (
|
||||
"image"
|
||||
"time"
|
||||
|
||||
"gioui.org/io/event"
|
||||
"gioui.org/io/system"
|
||||
"gioui.org/op"
|
||||
"gioui.org/unit"
|
||||
)
|
||||
@@ -53,20 +53,11 @@ type Context struct {
|
||||
// operation.
|
||||
Dimensions Dimensions
|
||||
|
||||
Config
|
||||
system.Config
|
||||
event.Queue
|
||||
*op.Ops
|
||||
}
|
||||
|
||||
// Config define the essential properties of
|
||||
// the environment.
|
||||
type Config interface {
|
||||
// Now returns the current animation time.
|
||||
Now() time.Time
|
||||
|
||||
unit.Converter
|
||||
}
|
||||
|
||||
const (
|
||||
Start Alignment = iota
|
||||
End
|
||||
@@ -104,7 +95,7 @@ func (s *Context) Layout(cs Constraints, w Widget) Dimensions {
|
||||
|
||||
// Reset the context. The constraints' minimum and maximum values are
|
||||
// set to the size.
|
||||
func (c *Context) Reset(cfg Config, size image.Point) {
|
||||
func (c *Context) Reset(cfg system.Config, size image.Point) {
|
||||
c.Constraints = RigidConstraints(size)
|
||||
c.Dimensions = Dimensions{}
|
||||
c.Config = cfg
|
||||
|
||||
Reference in New Issue
Block a user