mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
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:
+3
-3
@@ -53,8 +53,8 @@ type FrameEvent struct {
|
|||||||
// Frame completes the FrameEvent by drawing the graphical operations
|
// Frame completes the FrameEvent by drawing the graphical operations
|
||||||
// from ops into the window.
|
// from ops into the window.
|
||||||
Frame func(frame *op.Ops)
|
Frame func(frame *op.Ops)
|
||||||
// Queue supplies the events for event handlers.
|
// Source supplies the events for event handlers.
|
||||||
Queue event.Queue
|
Source event.Queue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insets is the space taken up by
|
// Insets is the space taken up by
|
||||||
@@ -96,7 +96,7 @@ func NewContext(ops *op.Ops, e FrameEvent) layout.Context {
|
|||||||
return layout.Context{
|
return layout.Context{
|
||||||
Ops: ops,
|
Ops: ops,
|
||||||
Now: e.Now,
|
Now: e.Now,
|
||||||
Queue: e.Queue,
|
Source: e.Source,
|
||||||
Metric: e.Metric,
|
Metric: e.Metric,
|
||||||
Constraints: layout.Exact(size),
|
Constraints: layout.Exact(size),
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ func FuzzIME(f *testing.F) {
|
|||||||
e.Focus()
|
e.Focus()
|
||||||
|
|
||||||
var r input.Router
|
var r input.Router
|
||||||
gtx := layout.Context{Ops: new(op.Ops), Queue: &r}
|
gtx := layout.Context{Ops: new(op.Ops), Source: &r}
|
||||||
// Layout once to register focus.
|
// Layout once to register focus.
|
||||||
e.Layout(gtx, cache, font.Font{}, unit.Sp(10), op.CallOp{}, op.CallOp{})
|
e.Layout(gtx, cache, font.Font{}, unit.Sp(10), op.CallOp{}, op.CallOp{})
|
||||||
r.Frame(gtx.Ops)
|
r.Frame(gtx.Ops)
|
||||||
|
|||||||
+2
-2
@@ -832,7 +832,7 @@ func (w *Window) processEvent(d driver, e event.Event) bool {
|
|||||||
w.metric = e2.Metric
|
w.metric = e2.Metric
|
||||||
w.hasNextFrame = false
|
w.hasNextFrame = false
|
||||||
e2.Frame = w.update
|
e2.Frame = w.update
|
||||||
e2.Queue = &w.queue
|
e2.Source = &w.queue
|
||||||
|
|
||||||
// Prepare the decorations and update the frame insets.
|
// Prepare the decorations and update the frame insets.
|
||||||
wrapper := &w.decorations.Ops
|
wrapper := &w.decorations.Ops
|
||||||
@@ -1014,7 +1014,7 @@ func (w *Window) decorate(d driver, e FrameEvent, o *op.Ops) (size, offset image
|
|||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: o,
|
Ops: o,
|
||||||
Now: e.Now,
|
Now: e.Now,
|
||||||
Queue: e.Queue,
|
Source: e.Source,
|
||||||
Metric: e.Metric,
|
Metric: e.Metric,
|
||||||
Constraints: layout.Exact(e.Size),
|
Constraints: layout.Exact(e.Size),
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -20,9 +20,9 @@ type Context struct {
|
|||||||
Constraints Constraints
|
Constraints Constraints
|
||||||
|
|
||||||
Metric unit.Metric
|
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.
|
// in a disabled state.
|
||||||
Queue event.Queue
|
Source event.Queue
|
||||||
// Now is the animation time.
|
// Now is the animation time.
|
||||||
Now time.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
|
// Events returns the events available for the key. If no
|
||||||
// queue is configured, Events returns nil.
|
// queue is configured, Events returns nil.
|
||||||
func (c Context) Events(k event.Tag) []event.Event {
|
func (c Context) Events(k event.Tag) []event.Event {
|
||||||
if c.Queue == nil {
|
if c.Source == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return c.Queue.Events(k)
|
return c.Source.Events(k)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabled returns a copy of this context with a nil Queue,
|
// 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
|
// By convention, a nil Queue is a signal to widgets to draw themselves
|
||||||
// in a disabled state.
|
// in a disabled state.
|
||||||
func (c Context) Disabled() Context {
|
func (c Context) Disabled() Context {
|
||||||
c.Queue = nil
|
c.Source = nil
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ func TestListPosition(t *testing.T) {
|
|||||||
Constraints: Constraints{
|
Constraints: Constraints{
|
||||||
Max: image.Pt(20, 10),
|
Max: image.Pt(20, 10),
|
||||||
},
|
},
|
||||||
Queue: r,
|
Source: r,
|
||||||
}
|
}
|
||||||
el := func(gtx Context, idx int) Dimensions {
|
el := func(gtx Context, idx int) Dimensions {
|
||||||
return Dimensions{Size: image.Pt(10, 10)}
|
return Dimensions{Size: image.Pt(10, 10)}
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ func (b *Bool) Layout(gtx layout.Context, w layout.Widget) layout.Dimensions {
|
|||||||
b.Update(gtx)
|
b.Update(gtx)
|
||||||
dims := b.clk.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
dims := b.clk.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||||
semantic.SelectedOp(b.Value).Add(gtx.Ops)
|
semantic.SelectedOp(b.Value).Add(gtx.Ops)
|
||||||
semantic.EnabledOp(gtx.Queue != nil).Add(gtx.Ops)
|
semantic.EnabledOp(gtx.Source != nil).Add(gtx.Ops)
|
||||||
return w(gtx)
|
return w(gtx)
|
||||||
})
|
})
|
||||||
return dims
|
return dims
|
||||||
|
|||||||
+2
-2
@@ -101,7 +101,7 @@ func (b *Clickable) Layout(gtx layout.Context, w layout.Widget) layout.Dimension
|
|||||||
dims := w(gtx)
|
dims := w(gtx)
|
||||||
c := m.Stop()
|
c := m.Stop()
|
||||||
defer clip.Rect(image.Rectangle{Max: dims.Size}).Push(gtx.Ops).Pop()
|
defer clip.Rect(image.Rectangle{Max: dims.Size}).Push(gtx.Ops).Pop()
|
||||||
enabled := gtx.Queue != nil
|
enabled := gtx.Source != nil
|
||||||
semantic.EnabledOp(enabled).Add(gtx.Ops)
|
semantic.EnabledOp(enabled).Add(gtx.Ops)
|
||||||
b.click.Add(gtx.Ops)
|
b.click.Add(gtx.Ops)
|
||||||
if enabled {
|
if enabled {
|
||||||
@@ -119,7 +119,7 @@ func (b *Clickable) Layout(gtx layout.Context, w layout.Widget) layout.Dimension
|
|||||||
// clicks, if any.
|
// clicks, if any.
|
||||||
func (b *Clickable) Update(gtx layout.Context) []Click {
|
func (b *Clickable) Update(gtx layout.Context) []Click {
|
||||||
b.clicks = nil
|
b.clicks = nil
|
||||||
if gtx.Queue == nil {
|
if gtx.Source == nil {
|
||||||
b.focused = false
|
b.focused = false
|
||||||
}
|
}
|
||||||
if b.requestFocus {
|
if b.requestFocus {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func TestClickable(t *testing.T) {
|
|||||||
b1 widget.Clickable
|
b1 widget.Clickable
|
||||||
b2 widget.Clickable
|
b2 widget.Clickable
|
||||||
)
|
)
|
||||||
gtx := app.NewContext(&ops, app.FrameEvent{Queue: &r})
|
gtx := app.NewContext(&ops, app.FrameEvent{Source: &r})
|
||||||
layout := func() {
|
layout := func() {
|
||||||
b1.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
b1.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||||
return layout.Dimensions{Size: image.Pt(100, 100)}
|
return layout.Dimensions{Size: image.Pt(100, 100)}
|
||||||
|
|||||||
+3
-3
@@ -24,7 +24,7 @@ type Draggable struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *Draggable) Layout(gtx layout.Context, w, drag layout.Widget) layout.Dimensions {
|
func (d *Draggable) Layout(gtx layout.Context, w, drag layout.Widget) layout.Dimensions {
|
||||||
if gtx.Queue == nil {
|
if gtx.Source == nil {
|
||||||
return w(gtx)
|
return w(gtx)
|
||||||
}
|
}
|
||||||
dims := w(gtx)
|
dims := w(gtx)
|
||||||
@@ -56,7 +56,7 @@ func (d *Draggable) Dragging() bool {
|
|||||||
// requested to offer data, if any
|
// requested to offer data, if any
|
||||||
func (d *Draggable) Update(gtx layout.Context) (mime string, requested bool) {
|
func (d *Draggable) Update(gtx layout.Context) (mime string, requested bool) {
|
||||||
pos := d.pos
|
pos := d.pos
|
||||||
for _, ev := range d.drag.Update(gtx.Metric, gtx.Queue, gesture.Both) {
|
for _, ev := range d.drag.Update(gtx.Metric, gtx.Source, gesture.Both) {
|
||||||
switch ev.Kind {
|
switch ev.Kind {
|
||||||
case pointer.Press:
|
case pointer.Press:
|
||||||
d.click = ev.Position
|
d.click = ev.Position
|
||||||
@@ -67,7 +67,7 @@ func (d *Draggable) Update(gtx layout.Context) (mime string, requested bool) {
|
|||||||
}
|
}
|
||||||
d.pos = pos
|
d.pos = pos
|
||||||
|
|
||||||
for _, ev := range gtx.Queue.Events(&d.handle) {
|
for _, ev := range gtx.Source.Events(&d.handle) {
|
||||||
if e, ok := ev.(transfer.RequestEvent); ok {
|
if e, ok := ev.(transfer.RequestEvent); ok {
|
||||||
return e.Type, true
|
return e.Type, true
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ func TestDraggable(t *testing.T) {
|
|||||||
var r input.Router
|
var r input.Router
|
||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
Queue: &r,
|
Source: &r,
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -677,7 +677,7 @@ func (e *Editor) layout(gtx layout.Context, textMaterial, selectMaterial op.Call
|
|||||||
}
|
}
|
||||||
e.showCaret = e.focused && (!blinking || dt%timePerBlink < timePerBlink/2)
|
e.showCaret = e.focused && (!blinking || dt%timePerBlink < timePerBlink/2)
|
||||||
}
|
}
|
||||||
disabled := gtx.Queue == nil
|
disabled := gtx.Source == nil
|
||||||
|
|
||||||
semantic.Editor.Add(gtx.Ops)
|
semantic.Editor.Add(gtx.Ops)
|
||||||
if e.Len() > 0 {
|
if e.Len() > 0 {
|
||||||
|
|||||||
+10
-10
@@ -103,7 +103,7 @@ func TestEditorReadOnly(t *testing.T) {
|
|||||||
Max: image.Pt(100, 100),
|
Max: image.Pt(100, 100),
|
||||||
},
|
},
|
||||||
Locale: english,
|
Locale: english,
|
||||||
Queue: r,
|
Source: r,
|
||||||
}
|
}
|
||||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||||
fontSize := unit.Sp(10)
|
fontSize := unit.Sp(10)
|
||||||
@@ -505,7 +505,7 @@ func TestEditorDimensions(t *testing.T) {
|
|||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Constraints{Max: image.Pt(100, 100)},
|
Constraints: layout.Constraints{Max: image.Pt(100, 100)},
|
||||||
Queue: r,
|
Source: r,
|
||||||
Locale: english,
|
Locale: english,
|
||||||
}
|
}
|
||||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||||
@@ -891,7 +891,7 @@ g 2 4 6 8 g
|
|||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Locale: english,
|
Locale: english,
|
||||||
Queue: r,
|
Source: r,
|
||||||
}
|
}
|
||||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||||
font := font.Font{}
|
font := font.Font{}
|
||||||
@@ -900,13 +900,13 @@ g 2 4 6 8 g
|
|||||||
var tim time.Duration
|
var tim time.Duration
|
||||||
selected := func(start, end int) string {
|
selected := func(start, end int) string {
|
||||||
// Layout once with no events; populate e.lines.
|
// Layout once with no events; populate e.lines.
|
||||||
gtx.Queue = nil
|
gtx.Source = nil
|
||||||
e.Layout(gtx, cache, font, fontSize, op.CallOp{}, op.CallOp{})
|
e.Layout(gtx, cache, font, fontSize, op.CallOp{}, op.CallOp{})
|
||||||
e.Events() // throw away any events from this layout
|
e.Events() // throw away any events from this layout
|
||||||
|
|
||||||
e.Focus()
|
e.Focus()
|
||||||
r.Frame(gtx.Ops)
|
r.Frame(gtx.Ops)
|
||||||
gtx.Queue = r
|
gtx.Source = r
|
||||||
// Build the selection events
|
// Build the selection events
|
||||||
startPos := e.text.closestToRune(start)
|
startPos := e.text.closestToRune(start)
|
||||||
endPos := e.text.closestToRune(end)
|
endPos := e.text.closestToRune(end)
|
||||||
@@ -972,7 +972,7 @@ g 2 4 6 8 g
|
|||||||
// Constrain the editor to roughly 6 columns wide and redraw
|
// Constrain the editor to roughly 6 columns wide and redraw
|
||||||
gtx.Constraints = layout.Exact(image.Pt(36, 36))
|
gtx.Constraints = layout.Exact(image.Pt(36, 36))
|
||||||
// Keep existing selection
|
// Keep existing selection
|
||||||
gtx.Queue = nil
|
gtx.Source = nil
|
||||||
e.Layout(gtx, cache, font, fontSize, op.CallOp{}, op.CallOp{})
|
e.Layout(gtx, cache, font, fontSize, op.CallOp{}, op.CallOp{})
|
||||||
|
|
||||||
caretStart := e.text.closestToRune(e.text.caret.start)
|
caretStart := e.text.closestToRune(e.text.caret.start)
|
||||||
@@ -991,7 +991,7 @@ func TestSelectMove(t *testing.T) {
|
|||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Locale: english,
|
Locale: english,
|
||||||
Queue: r,
|
Source: r,
|
||||||
}
|
}
|
||||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||||
font := font.Font{}
|
font := font.Font{}
|
||||||
@@ -1080,7 +1080,7 @@ func TestEditor_MaxLen(t *testing.T) {
|
|||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
Queue: r,
|
Source: r,
|
||||||
}
|
}
|
||||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||||
fontSize := unit.Sp(10)
|
fontSize := unit.Sp(10)
|
||||||
@@ -1116,7 +1116,7 @@ func TestEditor_Filter(t *testing.T) {
|
|||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
Queue: r,
|
Source: r,
|
||||||
}
|
}
|
||||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||||
fontSize := unit.Sp(10)
|
fontSize := unit.Sp(10)
|
||||||
@@ -1146,7 +1146,7 @@ func TestEditor_Submit(t *testing.T) {
|
|||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
Queue: r,
|
Source: r,
|
||||||
}
|
}
|
||||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||||
fontSize := unit.Sp(10)
|
fontSize := unit.Sp(10)
|
||||||
|
|||||||
+2
-2
@@ -40,7 +40,7 @@ func (e *Enum) index(k string) *enumKey {
|
|||||||
|
|
||||||
// Update the state and report whether Value has changed by user interaction.
|
// Update the state and report whether Value has changed by user interaction.
|
||||||
func (e *Enum) Update(gtx layout.Context) bool {
|
func (e *Enum) Update(gtx layout.Context) bool {
|
||||||
if gtx.Queue == nil {
|
if gtx.Source == nil {
|
||||||
e.focused = false
|
e.focused = false
|
||||||
}
|
}
|
||||||
e.hovering = false
|
e.hovering = false
|
||||||
@@ -117,7 +117,7 @@ func (e *Enum) Layout(gtx layout.Context, k string, content layout.Widget) layou
|
|||||||
}
|
}
|
||||||
clk := &state.click
|
clk := &state.click
|
||||||
clk.Add(gtx.Ops)
|
clk.Add(gtx.Ops)
|
||||||
enabled := gtx.Queue != nil
|
enabled := gtx.Source != nil
|
||||||
if enabled {
|
if enabled {
|
||||||
key.InputOp{Tag: &state.tag, Keys: "⏎|Space"}.Add(gtx.Ops)
|
key.InputOp{Tag: &state.tag, Keys: "⏎|Space"}.Add(gtx.Ops)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func ExampleClickable_passthrough() {
|
|||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
Queue: &r,
|
Source: &r,
|
||||||
}
|
}
|
||||||
|
|
||||||
// widget lays out two buttons on top of each other.
|
// widget lays out two buttons on top of each other.
|
||||||
@@ -75,7 +75,7 @@ func ExampleDraggable_Layout() {
|
|||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Constraints: layout.Exact(image.Pt(100, 100)),
|
Constraints: layout.Exact(image.Pt(100, 100)),
|
||||||
Queue: &r,
|
Source: &r,
|
||||||
}
|
}
|
||||||
// mime is the type used to match drag and drop operations.
|
// mime is the type used to match drag and drop operations.
|
||||||
// It could be left empty in this example.
|
// It could be left empty in this example.
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ func (b ButtonLayoutStyle) Layout(gtx layout.Context, w layout.Widget) layout.Di
|
|||||||
defer clip.UniformRRect(image.Rectangle{Max: gtx.Constraints.Min}, rr).Push(gtx.Ops).Pop()
|
defer clip.UniformRRect(image.Rectangle{Max: gtx.Constraints.Min}, rr).Push(gtx.Ops).Pop()
|
||||||
background := b.Background
|
background := b.Background
|
||||||
switch {
|
switch {
|
||||||
case gtx.Queue == nil:
|
case gtx.Source == nil:
|
||||||
background = f32color.Disabled(b.Background)
|
background = f32color.Disabled(b.Background)
|
||||||
case b.Button.Hovered() || b.Button.Focused():
|
case b.Button.Hovered() || b.Button.Focused():
|
||||||
background = f32color.Hovered(b.Background)
|
background = f32color.Hovered(b.Background)
|
||||||
@@ -165,7 +165,7 @@ func (b IconButtonStyle) Layout(gtx layout.Context) layout.Dimensions {
|
|||||||
defer clip.UniformRRect(image.Rectangle{Max: gtx.Constraints.Min}, rr).Push(gtx.Ops).Pop()
|
defer clip.UniformRRect(image.Rectangle{Max: gtx.Constraints.Min}, rr).Push(gtx.Ops).Pop()
|
||||||
background := b.Background
|
background := b.Background
|
||||||
switch {
|
switch {
|
||||||
case gtx.Queue == nil:
|
case gtx.Source == nil:
|
||||||
background = f32color.Disabled(b.Background)
|
background = f32color.Disabled(b.Background)
|
||||||
case b.Button.Hovered() || b.Button.Focused():
|
case b.Button.Hovered() || b.Button.Focused():
|
||||||
background = f32color.Hovered(b.Background)
|
background = f32color.Hovered(b.Background)
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func (c *checkable) layout(gtx layout.Context, checked, hovered bool) layout.Dim
|
|||||||
return layout.UniformInset(2).Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
return layout.UniformInset(2).Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||||
size := gtx.Dp(c.Size)
|
size := gtx.Dp(c.Size)
|
||||||
col := c.IconColor
|
col := c.IconColor
|
||||||
if gtx.Queue == nil {
|
if gtx.Source == nil {
|
||||||
col = f32color.Disabled(col)
|
col = f32color.Disabled(col)
|
||||||
}
|
}
|
||||||
gtx.Constraints.Min = image.Point{X: size}
|
gtx.Constraints.Min = image.Point{X: size}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ func (e EditorStyle) Layout(gtx layout.Context) layout.Dimensions {
|
|||||||
paint.ColorOp{Color: e.HintColor}.Add(gtx.Ops)
|
paint.ColorOp{Color: e.HintColor}.Add(gtx.Ops)
|
||||||
hintColor := hintColorMacro.Stop()
|
hintColor := hintColorMacro.Stop()
|
||||||
selectionColorMacro := op.Record(gtx.Ops)
|
selectionColorMacro := op.Record(gtx.Ops)
|
||||||
paint.ColorOp{Color: blendDisabledColor(gtx.Queue == nil, e.SelectionColor)}.Add(gtx.Ops)
|
paint.ColorOp{Color: blendDisabledColor(gtx.Source == nil, e.SelectionColor)}.Add(gtx.Ops)
|
||||||
selectionColor := selectionColorMacro.Stop()
|
selectionColor := selectionColorMacro.Stop()
|
||||||
|
|
||||||
var maxlines int
|
var maxlines int
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ func (p ProgressBarStyle) Layout(gtx layout.Context) layout.Dimensions {
|
|||||||
layout.Stacked(func(gtx layout.Context) layout.Dimensions {
|
layout.Stacked(func(gtx layout.Context) layout.Dimensions {
|
||||||
fillWidth := int(float32(progressBarWidth) * clamp1(p.Progress))
|
fillWidth := int(float32(progressBarWidth) * clamp1(p.Progress))
|
||||||
fillColor := p.Color
|
fillColor := p.Color
|
||||||
if gtx.Queue == nil {
|
if gtx.Source == nil {
|
||||||
fillColor = f32color.Disabled(fillColor)
|
fillColor = f32color.Disabled(fillColor)
|
||||||
}
|
}
|
||||||
return shader(fillWidth, fillColor)
|
return shader(fillWidth, fillColor)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ func (s SliderStyle) Layout(gtx layout.Context) layout.Dimensions {
|
|||||||
trans.Pop()
|
trans.Pop()
|
||||||
|
|
||||||
color := s.Color
|
color := s.Color
|
||||||
if gtx.Queue == nil {
|
if gtx.Source == nil {
|
||||||
color = f32color.Disabled(color)
|
color = f32color.Disabled(color)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ func (s SwitchStyle) Layout(gtx layout.Context) layout.Dimensions {
|
|||||||
if s.Switch.Value {
|
if s.Switch.Value {
|
||||||
col = s.Color.Enabled
|
col = s.Color.Enabled
|
||||||
}
|
}
|
||||||
if gtx.Queue == nil {
|
if gtx.Source == nil {
|
||||||
col = f32color.Disabled(col)
|
col = f32color.Disabled(col)
|
||||||
}
|
}
|
||||||
trackColor := s.Color.Track
|
trackColor := s.Color.Track
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func TestSelectableMove(t *testing.T) {
|
|||||||
gtx := layout.Context{
|
gtx := layout.Context{
|
||||||
Ops: new(op.Ops),
|
Ops: new(op.Ops),
|
||||||
Locale: english,
|
Locale: english,
|
||||||
Queue: r,
|
Source: r,
|
||||||
}
|
}
|
||||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||||
fnt := font.Font{}
|
fnt := font.Font{}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func TestBool(t *testing.T) {
|
|||||||
r input.Router
|
r input.Router
|
||||||
b widget.Bool
|
b widget.Bool
|
||||||
)
|
)
|
||||||
gtx := app.NewContext(&ops, app.FrameEvent{Queue: &r})
|
gtx := app.NewContext(&ops, app.FrameEvent{Source: &r})
|
||||||
layout := func() {
|
layout := func() {
|
||||||
b.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
b.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||||
semantic.CheckBox.Add(gtx.Ops)
|
semantic.CheckBox.Add(gtx.Ops)
|
||||||
|
|||||||
Reference in New Issue
Block a user