mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
io/event: [API] rename InputOp to Op
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+5
-5
@@ -38,7 +38,7 @@ type Hover struct {
|
|||||||
|
|
||||||
// Add the gesture to detect hovering over the current pointer area.
|
// Add the gesture to detect hovering over the current pointer area.
|
||||||
func (h *Hover) Add(ops *op.Ops) {
|
func (h *Hover) Add(ops *op.Ops) {
|
||||||
event.InputOp(ops, h)
|
event.Op(ops, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update state and report whether a pointer is inside the area.
|
// Update state and report whether a pointer is inside the area.
|
||||||
@@ -163,7 +163,7 @@ const touchSlop = unit.Dp(3)
|
|||||||
|
|
||||||
// Add the handler to the operation list to receive click events.
|
// Add the handler to the operation list to receive click events.
|
||||||
func (c *Click) Add(ops *op.Ops) {
|
func (c *Click) Add(ops *op.Ops) {
|
||||||
event.InputOp(ops, c)
|
event.Op(ops, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hovered returns whether a pointer is inside the area.
|
// Hovered returns whether a pointer is inside the area.
|
||||||
@@ -260,9 +260,9 @@ func (ClickEvent) ImplementsEvent() {}
|
|||||||
|
|
||||||
// Add the handler to the operation list to receive scroll events.
|
// Add the handler to the operation list to receive scroll events.
|
||||||
// The bounds variable refers to the scrolling boundaries
|
// The bounds variable refers to the scrolling boundaries
|
||||||
// as defined in io/pointer.InputOp.
|
// as defined in [pointer.Filter].
|
||||||
func (s *Scroll) Add(ops *op.Ops) {
|
func (s *Scroll) Add(ops *op.Ops) {
|
||||||
event.InputOp(ops, s)
|
event.Op(ops, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop any remaining fling movement.
|
// Stop any remaining fling movement.
|
||||||
@@ -373,7 +373,7 @@ func (s *Scroll) State() ScrollState {
|
|||||||
|
|
||||||
// Add the handler to the operation list to receive drag events.
|
// Add the handler to the operation list to receive drag events.
|
||||||
func (d *Drag) Add(ops *op.Ops) {
|
func (d *Drag) Add(ops *op.Ops) {
|
||||||
event.InputOp(ops, d)
|
event.Op(ops, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update state and return the next drag event, if any.
|
// Update state and return the next drag event, if any.
|
||||||
|
|||||||
+2
-2
@@ -22,9 +22,9 @@ type Filter interface {
|
|||||||
ImplementsFilter()
|
ImplementsFilter()
|
||||||
}
|
}
|
||||||
|
|
||||||
// InputOp declares a tag for input routing at the current transformation
|
// Op declares a tag for input routing at the current transformation
|
||||||
// and clip area hierarchy. It panics if tag is nil.
|
// and clip area hierarchy. It panics if tag is nil.
|
||||||
func InputOp(o *op.Ops, tag Tag) {
|
func Op(o *op.Ops, tag Tag) {
|
||||||
if tag == nil {
|
if tag == nil {
|
||||||
panic("Tag must be non-nil")
|
panic("Tag must be non-nil")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ func TestInputWakeup(t *testing.T) {
|
|||||||
handler := new(int)
|
handler := new(int)
|
||||||
var ops op.Ops
|
var ops op.Ops
|
||||||
// InputOps shouldn't trigger redraws.
|
// InputOps shouldn't trigger redraws.
|
||||||
event.InputOp(&ops, handler)
|
event.Op(&ops, handler)
|
||||||
|
|
||||||
var r Router
|
var r Router
|
||||||
// Reset events shouldn't either.
|
// Reset events shouldn't either.
|
||||||
@@ -192,7 +192,7 @@ func TestKeyFocusedInvisible(t *testing.T) {
|
|||||||
|
|
||||||
// Respawn the first element:
|
// Respawn the first element:
|
||||||
// It must receive one `Event{Focus: false}`.
|
// It must receive one `Event{Focus: false}`.
|
||||||
event.InputOp(ops, &handlers[0])
|
event.Op(ops, &handlers[0])
|
||||||
|
|
||||||
assertEventSequence(t, events(r, -1, key.FocusFilter{Target: &handlers[0]}), key.FocusEvent{Focus: false})
|
assertEventSequence(t, events(r, -1, key.FocusFilter{Target: &handlers[0]}), key.FocusEvent{Focus: false})
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ func TestDirectionalFocus(t *testing.T) {
|
|||||||
|
|
||||||
for i, bounds := range handlers {
|
for i, bounds := range handlers {
|
||||||
cl := clip.Rect(bounds).Push(ops)
|
cl := clip.Rect(bounds).Push(ops)
|
||||||
event.InputOp(ops, &handlers[i])
|
event.Op(ops, &handlers[i])
|
||||||
cl.Pop()
|
cl.Pop()
|
||||||
events(r, -1, key.FocusFilter{Target: &handlers[i]})
|
events(r, -1, key.FocusFilter{Target: &handlers[i]})
|
||||||
}
|
}
|
||||||
@@ -259,9 +259,9 @@ func TestFocusScroll(t *testing.T) {
|
|||||||
events(r, -1, filters...)
|
events(r, -1, filters...)
|
||||||
parent := clip.Rect(image.Rect(1, 1, 14, 39)).Push(ops)
|
parent := clip.Rect(image.Rect(1, 1, 14, 39)).Push(ops)
|
||||||
cl := clip.Rect(image.Rect(10, -20, 20, 30)).Push(ops)
|
cl := clip.Rect(image.Rect(10, -20, 20, 30)).Push(ops)
|
||||||
event.InputOp(ops, h)
|
event.Op(ops, h)
|
||||||
// Test that h is scrolled even if behind another handler.
|
// Test that h is scrolled even if behind another handler.
|
||||||
event.InputOp(ops, new(int))
|
event.Op(ops, new(int))
|
||||||
cl.Pop()
|
cl.Pop()
|
||||||
parent.Pop()
|
parent.Pop()
|
||||||
r.Frame(ops)
|
r.Frame(ops)
|
||||||
@@ -286,7 +286,7 @@ func TestFocusClick(t *testing.T) {
|
|||||||
}
|
}
|
||||||
assertEventPointerTypeSequence(t, events(r, -1, filters...), pointer.Cancel)
|
assertEventPointerTypeSequence(t, events(r, -1, filters...), pointer.Cancel)
|
||||||
cl := clip.Rect(image.Rect(0, 0, 10, 10)).Push(ops)
|
cl := clip.Rect(image.Rect(0, 0, 10, 10)).Push(ops)
|
||||||
event.InputOp(ops, h)
|
event.Op(ops, h)
|
||||||
cl.Pop()
|
cl.Pop()
|
||||||
r.Frame(ops)
|
r.Frame(ops)
|
||||||
|
|
||||||
|
|||||||
+30
-30
@@ -107,9 +107,9 @@ func TestPointerGrab(t *testing.T) {
|
|||||||
return pointer.Filter{Target: t, Kinds: pointer.Press | pointer.Release | pointer.Cancel}
|
return pointer.Filter{Target: t, Kinds: pointer.Press | pointer.Release | pointer.Cancel}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.InputOp(&ops, handler1)
|
event.Op(&ops, handler1)
|
||||||
event.InputOp(&ops, handler2)
|
event.Op(&ops, handler2)
|
||||||
event.InputOp(&ops, handler3)
|
event.Op(&ops, handler3)
|
||||||
|
|
||||||
var r Router
|
var r Router
|
||||||
assertEventPointerTypeSequence(t, events(&r, -1, filter(handler1)), pointer.Cancel)
|
assertEventPointerTypeSequence(t, events(&r, -1, filter(handler1)), pointer.Cancel)
|
||||||
@@ -146,9 +146,9 @@ func TestPointerGrabSameHandlerTwice(t *testing.T) {
|
|||||||
return pointer.Filter{Target: t, Kinds: pointer.Press | pointer.Release | pointer.Cancel}
|
return pointer.Filter{Target: t, Kinds: pointer.Press | pointer.Release | pointer.Cancel}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.InputOp(&ops, handler1)
|
event.Op(&ops, handler1)
|
||||||
event.InputOp(&ops, handler1)
|
event.Op(&ops, handler1)
|
||||||
event.InputOp(&ops, handler2)
|
event.Op(&ops, handler2)
|
||||||
|
|
||||||
var r Router
|
var r Router
|
||||||
assertEventPointerTypeSequence(t, events(&r, -1, filter(handler1)), pointer.Cancel)
|
assertEventPointerTypeSequence(t, events(&r, -1, filter(handler1)), pointer.Cancel)
|
||||||
@@ -187,10 +187,10 @@ func TestPointerMove(t *testing.T) {
|
|||||||
|
|
||||||
// Handler 1 area: (0, 0) - (100, 100)
|
// Handler 1 area: (0, 0) - (100, 100)
|
||||||
r1 := clip.Rect(image.Rect(0, 0, 100, 100)).Push(&ops)
|
r1 := clip.Rect(image.Rect(0, 0, 100, 100)).Push(&ops)
|
||||||
event.InputOp(&ops, handler1)
|
event.Op(&ops, handler1)
|
||||||
// Handler 2 area: (50, 50) - (100, 100) (areas intersect).
|
// Handler 2 area: (50, 50) - (100, 100) (areas intersect).
|
||||||
r2 := clip.Rect(image.Rect(50, 50, 200, 200)).Push(&ops)
|
r2 := clip.Rect(image.Rect(50, 50, 200, 200)).Push(&ops)
|
||||||
event.InputOp(&ops, handler2)
|
event.Op(&ops, handler2)
|
||||||
r2.Pop()
|
r2.Pop()
|
||||||
r1.Pop()
|
r1.Pop()
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ func TestPointerTypes(t *testing.T) {
|
|||||||
Target: handler,
|
Target: handler,
|
||||||
Kinds: pointer.Press | pointer.Release | pointer.Cancel,
|
Kinds: pointer.Press | pointer.Release | pointer.Cancel,
|
||||||
}
|
}
|
||||||
event.InputOp(&ops, handler)
|
event.Op(&ops, handler)
|
||||||
r1.Pop()
|
r1.Pop()
|
||||||
|
|
||||||
var r Router
|
var r Router
|
||||||
@@ -306,7 +306,7 @@ func TestPointerPriority(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
events(&r, -1, f1(handler1))
|
events(&r, -1, f1(handler1))
|
||||||
event.InputOp(&ops, handler1)
|
event.Op(&ops, handler1)
|
||||||
|
|
||||||
r2 := clip.Rect(image.Rect(0, 0, 100, 50)).Push(&ops)
|
r2 := clip.Rect(image.Rect(0, 0, 100, 50)).Push(&ops)
|
||||||
f2 := func(t event.Tag) event.Filter {
|
f2 := func(t event.Tag) event.Filter {
|
||||||
@@ -317,7 +317,7 @@ func TestPointerPriority(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
events(&r, -1, f2(handler2))
|
events(&r, -1, f2(handler2))
|
||||||
event.InputOp(&ops, handler2)
|
event.Op(&ops, handler2)
|
||||||
r2.Pop()
|
r2.Pop()
|
||||||
r1.Pop()
|
r1.Pop()
|
||||||
|
|
||||||
@@ -330,7 +330,7 @@ func TestPointerPriority(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
events(&r, -1, f3(handler3))
|
events(&r, -1, f3(handler3))
|
||||||
event.InputOp(&ops, handler3)
|
event.Op(&ops, handler3)
|
||||||
r3.Pop()
|
r3.Pop()
|
||||||
|
|
||||||
r.Frame(&ops)
|
r.Frame(&ops)
|
||||||
@@ -480,7 +480,7 @@ func TestMultipleAreas(t *testing.T) {
|
|||||||
f := addPointerHandler(&r, &ops, handler, image.Rect(0, 0, 100, 100))
|
f := addPointerHandler(&r, &ops, handler, image.Rect(0, 0, 100, 100))
|
||||||
r1 := clip.Rect(image.Rect(50, 50, 200, 200)).Push(&ops)
|
r1 := clip.Rect(image.Rect(50, 50, 200, 200)).Push(&ops)
|
||||||
// Test that declaring a handler twice doesn't affect event handling.
|
// Test that declaring a handler twice doesn't affect event handling.
|
||||||
event.InputOp(&ops, handler)
|
event.Op(&ops, handler)
|
||||||
r1.Pop()
|
r1.Pop()
|
||||||
|
|
||||||
assertEventPointerTypeSequence(t, events(&r, -1, f))
|
assertEventPointerTypeSequence(t, events(&r, -1, f))
|
||||||
@@ -517,11 +517,11 @@ func TestPointerEnterLeaveNested(t *testing.T) {
|
|||||||
|
|
||||||
// Handler 1 area: (0, 0) - (100, 100)
|
// Handler 1 area: (0, 0) - (100, 100)
|
||||||
r1 := clip.Rect(image.Rect(0, 0, 100, 100)).Push(&ops)
|
r1 := clip.Rect(image.Rect(0, 0, 100, 100)).Push(&ops)
|
||||||
event.InputOp(&ops, handler1)
|
event.Op(&ops, handler1)
|
||||||
|
|
||||||
// Handler 2 area: (25, 25) - (75, 75) (nested within first).
|
// Handler 2 area: (25, 25) - (75, 75) (nested within first).
|
||||||
r2 := clip.Rect(image.Rect(25, 25, 75, 75)).Push(&ops)
|
r2 := clip.Rect(image.Rect(25, 25, 75, 75)).Push(&ops)
|
||||||
event.InputOp(&ops, handler2)
|
event.Op(&ops, handler2)
|
||||||
r2.Pop()
|
r2.Pop()
|
||||||
r1.Pop()
|
r1.Pop()
|
||||||
|
|
||||||
@@ -758,15 +758,15 @@ func TestPassOp(t *testing.T) {
|
|||||||
h1, h2, h3, h4 := new(int), new(int), new(int), new(int)
|
h1, h2, h3, h4 := new(int), new(int), new(int), new(int)
|
||||||
area := clip.Rect(image.Rect(0, 0, 100, 100))
|
area := clip.Rect(image.Rect(0, 0, 100, 100))
|
||||||
root := area.Push(&ops)
|
root := area.Push(&ops)
|
||||||
event.InputOp(&ops, &h1)
|
event.Op(&ops, &h1)
|
||||||
event.InputOp(&ops, h1)
|
event.Op(&ops, h1)
|
||||||
child1 := area.Push(&ops)
|
child1 := area.Push(&ops)
|
||||||
event.InputOp(&ops, h2)
|
event.Op(&ops, h2)
|
||||||
child1.Pop()
|
child1.Pop()
|
||||||
child2 := area.Push(&ops)
|
child2 := area.Push(&ops)
|
||||||
pass := pointer.PassOp{}.Push(&ops)
|
pass := pointer.PassOp{}.Push(&ops)
|
||||||
event.InputOp(&ops, h3)
|
event.Op(&ops, h3)
|
||||||
event.InputOp(&ops, h4)
|
event.Op(&ops, h4)
|
||||||
pass.Pop()
|
pass.Pop()
|
||||||
child2.Pop()
|
child2.Pop()
|
||||||
root.Pop()
|
root.Pop()
|
||||||
@@ -795,7 +795,7 @@ func TestAreaPassthrough(t *testing.T) {
|
|||||||
var ops op.Ops
|
var ops op.Ops
|
||||||
|
|
||||||
h := new(int)
|
h := new(int)
|
||||||
event.InputOp(&ops, h)
|
event.Op(&ops, h)
|
||||||
clip.Rect(image.Rect(0, 0, 100, 100)).Push(&ops).Pop()
|
clip.Rect(image.Rect(0, 0, 100, 100)).Push(&ops).Pop()
|
||||||
var r Router
|
var r Router
|
||||||
f := pointer.Filter{
|
f := pointer.Filter{
|
||||||
@@ -817,7 +817,7 @@ func TestEllipse(t *testing.T) {
|
|||||||
|
|
||||||
h := new(int)
|
h := new(int)
|
||||||
cl := clip.Ellipse(image.Rect(0, 0, 100, 100)).Push(&ops)
|
cl := clip.Ellipse(image.Rect(0, 0, 100, 100)).Push(&ops)
|
||||||
event.InputOp(&ops, h)
|
event.Op(&ops, h)
|
||||||
cl.Pop()
|
cl.Pop()
|
||||||
var r Router
|
var r Router
|
||||||
f := pointer.Filter{
|
f := pointer.Filter{
|
||||||
@@ -853,11 +853,11 @@ func TestTransfer(t *testing.T) {
|
|||||||
events(r, -1, transfer.TargetFilter{Target: tgt, Type: tgtType})
|
events(r, -1, transfer.TargetFilter{Target: tgt, Type: tgtType})
|
||||||
|
|
||||||
srcStack := clip.Rect(srcArea).Push(ops)
|
srcStack := clip.Rect(srcArea).Push(ops)
|
||||||
event.InputOp(ops, src)
|
event.Op(ops, src)
|
||||||
srcStack.Pop()
|
srcStack.Pop()
|
||||||
|
|
||||||
tgt1Stack := clip.Rect(tgtArea).Push(ops)
|
tgt1Stack := clip.Rect(tgtArea).Push(ops)
|
||||||
event.InputOp(ops, tgt)
|
event.Op(ops, tgt)
|
||||||
tgt1Stack.Pop()
|
tgt1Stack.Pop()
|
||||||
|
|
||||||
return src, tgt
|
return src, tgt
|
||||||
@@ -904,7 +904,7 @@ func TestTransfer(t *testing.T) {
|
|||||||
tgt2 := new(int)
|
tgt2 := new(int)
|
||||||
events(&r, -1, transfer.TargetFilter{Target: tgt2, Type: "nofile"})
|
events(&r, -1, transfer.TargetFilter{Target: tgt2, Type: "nofile"})
|
||||||
stack := clip.Rect(tgtArea).Push(ops)
|
stack := clip.Rect(tgtArea).Push(ops)
|
||||||
event.InputOp(ops, tgt2)
|
event.Op(ops, tgt2)
|
||||||
stack.Pop()
|
stack.Pop()
|
||||||
r.Frame(ops)
|
r.Frame(ops)
|
||||||
// Initiate a drag.
|
// Initiate a drag.
|
||||||
@@ -1050,7 +1050,7 @@ func TestDeferredInputOp(t *testing.T) {
|
|||||||
|
|
||||||
var r Router
|
var r Router
|
||||||
m := op.Record(&ops)
|
m := op.Record(&ops)
|
||||||
event.InputOp(&ops, new(int))
|
event.Op(&ops, new(int))
|
||||||
call := m.Stop()
|
call := m.Stop()
|
||||||
|
|
||||||
op.Defer(&ops, call)
|
op.Defer(&ops, call)
|
||||||
@@ -1063,13 +1063,13 @@ func TestPassCursor(t *testing.T) {
|
|||||||
|
|
||||||
rect := clip.Rect(image.Rect(0, 0, 100, 100))
|
rect := clip.Rect(image.Rect(0, 0, 100, 100))
|
||||||
background := rect.Push(&ops)
|
background := rect.Push(&ops)
|
||||||
event.InputOp(&ops, 1)
|
event.Op(&ops, 1)
|
||||||
pointer.CursorDefault.Add(&ops)
|
pointer.CursorDefault.Add(&ops)
|
||||||
background.Pop()
|
background.Pop()
|
||||||
|
|
||||||
overlayPass := pointer.PassOp{}.Push(&ops)
|
overlayPass := pointer.PassOp{}.Push(&ops)
|
||||||
overlay := rect.Push(&ops)
|
overlay := rect.Push(&ops)
|
||||||
event.InputOp(&ops, 2)
|
event.Op(&ops, 2)
|
||||||
want := pointer.CursorPointer
|
want := pointer.CursorPointer
|
||||||
want.Add(&ops)
|
want.Add(&ops)
|
||||||
overlay.Pop()
|
overlay.Pop()
|
||||||
@@ -1106,7 +1106,7 @@ func addPointerHandler(r *Router, ops *op.Ops, tag event.Tag, area image.Rectang
|
|||||||
}
|
}
|
||||||
events(r, -1, f)
|
events(r, -1, f)
|
||||||
defer clip.Rect(area).Push(ops).Pop()
|
defer clip.Rect(area).Push(ops).Pop()
|
||||||
event.InputOp(ops, tag)
|
event.Op(ops, tag)
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1245,7 +1245,7 @@ func BenchmarkRouterAdd(b *testing.B) {
|
|||||||
}).
|
}).
|
||||||
Push(&ops)
|
Push(&ops)
|
||||||
events(&r, -1, pointer.Filter{Target: handlers[i], Kinds: pointer.Move})
|
events(&r, -1, pointer.Filter{Target: handlers[i], Kinds: pointer.Move})
|
||||||
event.InputOp(&ops, handlers[i])
|
event.Op(&ops, handlers[i])
|
||||||
}
|
}
|
||||||
r.Frame(&ops)
|
r.Frame(&ops)
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ func TestSemanticDescription(t *testing.T) {
|
|||||||
var ops op.Ops
|
var ops op.Ops
|
||||||
|
|
||||||
h := new(int)
|
h := new(int)
|
||||||
event.InputOp(&ops, h)
|
event.Op(&ops, h)
|
||||||
semantic.DescriptionOp("description").Add(&ops)
|
semantic.DescriptionOp("description").Add(&ops)
|
||||||
semantic.LabelOp("label").Add(&ops)
|
semantic.LabelOp("label").Add(&ops)
|
||||||
semantic.Button.Add(&ops)
|
semantic.Button.Add(&ops)
|
||||||
|
|||||||
+1
-1
@@ -93,7 +93,7 @@ func (b *Clickable) layout(t event.Tag, gtx layout.Context, w layout.Widget) lay
|
|||||||
defer clip.Rect(image.Rectangle{Max: dims.Size}).Push(gtx.Ops).Pop()
|
defer clip.Rect(image.Rectangle{Max: dims.Size}).Push(gtx.Ops).Pop()
|
||||||
semantic.EnabledOp(gtx.Enabled()).Add(gtx.Ops)
|
semantic.EnabledOp(gtx.Enabled()).Add(gtx.Ops)
|
||||||
b.click.Add(gtx.Ops)
|
b.click.Add(gtx.Ops)
|
||||||
event.InputOp(gtx.Ops, t)
|
event.Op(gtx.Ops, t)
|
||||||
c.Add(gtx.Ops)
|
c.Add(gtx.Ops)
|
||||||
return dims
|
return dims
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ func (d *Draggable) Layout(gtx layout.Context, w, drag layout.Widget) layout.Dim
|
|||||||
|
|
||||||
stack := clip.Rect{Max: dims.Size}.Push(gtx.Ops)
|
stack := clip.Rect{Max: dims.Size}.Push(gtx.Ops)
|
||||||
d.drag.Add(gtx.Ops)
|
d.drag.Add(gtx.Ops)
|
||||||
event.InputOp(gtx.Ops, d)
|
event.Op(gtx.Ops, d)
|
||||||
stack.Pop()
|
stack.Pop()
|
||||||
|
|
||||||
if drag != nil && d.drag.Pressed() {
|
if drag != nil && d.drag.Pressed() {
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ func TestDraggable(t *testing.T) {
|
|||||||
return layout.Dimensions{Size: gtx.Constraints.Min}
|
return layout.Dimensions{Size: gtx.Constraints.Min}
|
||||||
}, nil)
|
}, nil)
|
||||||
stack := clip.Rect{Max: dims.Size}.Push(gtx.Ops)
|
stack := clip.Rect{Max: dims.Size}.Push(gtx.Ops)
|
||||||
event.InputOp(gtx.Ops, tgt)
|
event.Op(gtx.Ops, tgt)
|
||||||
stack.Pop()
|
stack.Pop()
|
||||||
|
|
||||||
drag.Update(gtx)
|
drag.Update(gtx)
|
||||||
|
|||||||
+1
-1
@@ -662,7 +662,7 @@ func (e *Editor) layout(gtx layout.Context, textMaterial, selectMaterial op.Call
|
|||||||
|
|
||||||
defer clip.Rect(image.Rectangle{Max: visibleDims.Size}).Push(gtx.Ops).Pop()
|
defer clip.Rect(image.Rectangle{Max: visibleDims.Size}).Push(gtx.Ops).Pop()
|
||||||
pointer.CursorText.Add(gtx.Ops)
|
pointer.CursorText.Add(gtx.Ops)
|
||||||
event.InputOp(gtx.Ops, e)
|
event.Op(gtx.Ops, e)
|
||||||
key.InputHintOp{Tag: e, Hint: e.InputHint}.Add(gtx.Ops)
|
key.InputHintOp{Tag: e, Hint: e.InputHint}.Add(gtx.Ops)
|
||||||
|
|
||||||
e.scroller.Add(gtx.Ops)
|
e.scroller.Add(gtx.Ops)
|
||||||
|
|||||||
+1
-1
@@ -130,7 +130,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)
|
||||||
event.InputOp(gtx.Ops, &state.tag)
|
event.Op(gtx.Ops, &state.tag)
|
||||||
semantic.SelectedOp(k == e.Value).Add(gtx.Ops)
|
semantic.SelectedOp(k == e.Value).Add(gtx.Ops)
|
||||||
semantic.EnabledOp(gtx.Enabled()).Add(gtx.Ops)
|
semantic.EnabledOp(gtx.Enabled()).Add(gtx.Ops)
|
||||||
c.Add(gtx.Ops)
|
c.Add(gtx.Ops)
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ func ExampleDraggable_Layout() {
|
|||||||
Min: image.Pt(20, 20),
|
Min: image.Pt(20, 20),
|
||||||
Max: image.Pt(40, 40),
|
Max: image.Pt(40, 40),
|
||||||
}.Push(gtx.Ops)
|
}.Push(gtx.Ops)
|
||||||
event.InputOp(gtx.Ops, &drop)
|
event.Op(gtx.Ops, &drop)
|
||||||
ds.Pop()
|
ds.Pop()
|
||||||
|
|
||||||
// Check for the received data.
|
// Check for the received data.
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ func (l *Selectable) Layout(gtx layout.Context, lt *text.Shaper, font font.Font,
|
|||||||
dims := l.text.Dimensions()
|
dims := l.text.Dimensions()
|
||||||
defer clip.Rect(image.Rectangle{Max: dims.Size}).Push(gtx.Ops).Pop()
|
defer clip.Rect(image.Rectangle{Max: dims.Size}).Push(gtx.Ops).Pop()
|
||||||
pointer.CursorText.Add(gtx.Ops)
|
pointer.CursorText.Add(gtx.Ops)
|
||||||
event.InputOp(gtx.Ops, l)
|
event.Op(gtx.Ops, l)
|
||||||
|
|
||||||
l.clicker.Add(gtx.Ops)
|
l.clicker.Add(gtx.Ops)
|
||||||
l.dragger.Add(gtx.Ops)
|
l.dragger.Add(gtx.Ops)
|
||||||
|
|||||||
Reference in New Issue
Block a user