mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
io/router: merge grab and types for multiple InputOps for same handler
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -109,8 +109,8 @@ func (q *pointerQueue) collectHandlers(r *ops.Reader, events *handlerEvents, t o
|
|||||||
}
|
}
|
||||||
h.active = true
|
h.active = true
|
||||||
h.area = area
|
h.area = area
|
||||||
h.wantsGrab = op.Grab
|
h.wantsGrab = h.wantsGrab || op.Grab
|
||||||
h.types = op.Types
|
h.types = h.types | op.Types
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,6 +169,8 @@ func (q *pointerQueue) Frame(root *op.Ops, events *handlerEvents) {
|
|||||||
for _, h := range q.handlers {
|
for _, h := range q.handlers {
|
||||||
// Reset handler.
|
// Reset handler.
|
||||||
h.active = false
|
h.active = false
|
||||||
|
h.wantsGrab = false
|
||||||
|
h.types = 0
|
||||||
}
|
}
|
||||||
q.hitTree = q.hitTree[:0]
|
q.hitTree = q.hitTree[:0]
|
||||||
q.areas = q.areas[:0]
|
q.areas = q.areas[:0]
|
||||||
|
|||||||
@@ -242,7 +242,12 @@ func TestMultipleAreas(t *testing.T) {
|
|||||||
var ops op.Ops
|
var ops op.Ops
|
||||||
|
|
||||||
addPointerHandler(&ops, handler, image.Rect(0, 0, 100, 100))
|
addPointerHandler(&ops, handler, image.Rect(0, 0, 100, 100))
|
||||||
addPointerHandler(&ops, handler, image.Rect(50, 50, 200, 200))
|
st := op.Push(&ops)
|
||||||
|
pointer.Rect(image.Rect(50, 50, 200, 200)).Add(&ops)
|
||||||
|
// Second area has no Types set, yet should receive events because
|
||||||
|
// Types for the same handles are or-ed together.
|
||||||
|
pointer.InputOp{Tag: handler}.Add(&ops)
|
||||||
|
st.Pop()
|
||||||
|
|
||||||
var r Router
|
var r Router
|
||||||
r.Frame(&ops)
|
r.Frame(&ops)
|
||||||
|
|||||||
Reference in New Issue
Block a user