~eliasnaur/gio-patches

gio: io/router: avoid unnecessary event copies in deliverEvent v1 PROPOSED

~pierrec
~pierrec: 1
 io/router: avoid unnecessary event copies in deliverEvent

 1 files changed, 14 insertions(+), 8 deletions(-)
#436359 apple.yml success
#436360 freebsd.yml success
#436361 linux.yml success
#436362 openbsd.yml success
Le mer. 24 févr. 2021 à 10:18, Elias Naur <mail@eliasnaur.com> a écrit :
Next
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio-patches/patches/20474/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH gio] io/router: avoid unnecessary event copies in deliverEvent Export this patch

~pierrec
From: pierre <pierre.curto@gmail.com>

Signed-off-by: pierre <pierre.curto@gmail.com>
---
 io/router/pointer.go | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/io/router/pointer.go b/io/router/pointer.go
index ab9348b..cd316dd 100644
--- a/io/router/pointer.go
+++ b/io/router/pointer.go
@@ -331,20 +331,26 @@ func (q *pointerQueue) Push(e pointer.Event, events *handlerEvents) {

func (q *pointerQueue) deliverEvent(p *pointerInfo, events *handlerEvents, e pointer.Event) {
	foremost := true
	pressedSingle := p.pressed && len(p.handlers) == 1
	pos := e.Position
	for _, k := range p.handlers {
		h := q.handlers[k]
		e := e
		if p.pressed && len(p.handlers) == 1 {
			e.Priority = pointer.Grabbed
		} else if foremost {
			e.Priority = pointer.Foremost
		if e.Type&h.types == 0 {
			continue
		}

		if e.Type&h.types != 0 {
			e.Position = q.invTransform(h.area, e.Position)
		e.Position = q.invTransform(h.area, pos)
		switch {
		case pressedSingle:
			e.Priority = pointer.Grabbed
		case foremost:
			foremost = false
			priority := e.Priority
			e.Priority = pointer.Foremost
			events.Add(k, e)
			e.Priority = priority
			continue
		}
		events.Add(k, e)
	}
}

-- 
2.30.1
builds.sr.ht
gio/patches: SUCCESS in 27m57s

[io/router: avoid unnecessary event copies in deliverEvent][0] from [~pierrec][1]

[0]: https://lists.sr.ht/~eliasnaur/gio-patches/patches/20474
[1]: mailto:pierre.curto@gmail.com

✓ #436361 SUCCESS gio/patches/linux.yml   https://builds.sr.ht/~eliasnaur/job/436361
✓ #436359 SUCCESS gio/patches/apple.yml   https://builds.sr.ht/~eliasnaur/job/436359
✓ #436360 SUCCESS gio/patches/freebsd.yml https://builds.sr.ht/~eliasnaur/job/436360
✓ #436362 SUCCESS gio/patches/openbsd.yml https://builds.sr.ht/~eliasnaur/job/436362