layout,app: [API] rename FrameEvent.Queue and Context.Queue to Source

We're about to replace the interface Queue with a concrete input.Source.
This change renames the field accordingly.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-10-08 17:58:36 -05:00
parent d5a0d2cf60
commit 4fcd96ac4b
22 changed files with 44 additions and 44 deletions
+5 -5
View File
@@ -20,9 +20,9 @@ type Context struct {
Constraints Constraints
Metric unit.Metric
// By convention, a nil Queue is a signal to widgets to draw themselves
// By convention, a nil Source is a signal to widgets to draw themselves
// in a disabled state.
Queue event.Queue
Source event.Queue
// Now is the animation time.
Now time.Time
@@ -47,10 +47,10 @@ func (c Context) Sp(v unit.Sp) int {
// Events returns the events available for the key. If no
// queue is configured, Events returns nil.
func (c Context) Events(k event.Tag) []event.Event {
if c.Queue == nil {
if c.Source == nil {
return nil
}
return c.Queue.Events(k)
return c.Source.Events(k)
}
// Disabled returns a copy of this context with a nil Queue,
@@ -59,6 +59,6 @@ func (c Context) Events(k event.Tag) []event.Event {
// By convention, a nil Queue is a signal to widgets to draw themselves
// in a disabled state.
func (c Context) Disabled() Context {
c.Queue = nil
c.Source = nil
return c
}
+1 -1
View File
@@ -70,7 +70,7 @@ func TestListPosition(t *testing.T) {
Constraints: Constraints{
Max: image.Pt(20, 10),
},
Queue: r,
Source: r,
}
el := func(gtx Context, idx int) Dimensions {
return Dimensions{Size: image.Pt(10, 10)}