mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 10:25:37 +00:00
all: serialize ops
Pros: - Much less per-frame garbage - Allow future preprocessing of ops while building it - Much fewer interface calls and pointer chasing - Allow future serialization of ops for remote rendering Cons: - Slightly clumsier API Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -83,8 +83,9 @@ const (
|
||||
thresholdVelocity = 1
|
||||
)
|
||||
|
||||
func (c *Click) Op(a pointer.Area) pointer.OpHandler {
|
||||
return pointer.OpHandler{Area: a, Key: c}
|
||||
func (c *Click) Op(ops *ui.Ops, a pointer.Area) {
|
||||
op := pointer.OpHandler{Area: a, Key: c}
|
||||
op.Add(ops)
|
||||
}
|
||||
|
||||
func (c *Click) Update(q pointer.Events) []ClickEvent {
|
||||
@@ -115,12 +116,12 @@ func (c *Click) Update(q pointer.Events) []ClickEvent {
|
||||
return events
|
||||
}
|
||||
|
||||
func (s *Scroll) Op(a pointer.Area) ui.Op {
|
||||
func (s *Scroll) Op(ops *ui.Ops, a pointer.Area) {
|
||||
oph := pointer.OpHandler{Area: a, Key: s, Grab: s.grab}
|
||||
if !s.flinger.Active() {
|
||||
return oph
|
||||
oph.Add(ops)
|
||||
if s.flinger.Active() {
|
||||
ui.OpRedraw{}.Add(ops)
|
||||
}
|
||||
return ui.Ops{oph, ui.OpRedraw{}}
|
||||
}
|
||||
|
||||
func (s *Scroll) Stop() {
|
||||
|
||||
Reference in New Issue
Block a user