mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
io/router: deliver enter/leave events to transfer participants
When a drag and drop gesture is ongoing, let the potential target handlers receive enter/leave events so that they can react to them (e.g. highlight themselves when the dragged item is over them). Fixes #321. Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
+13
-2
@@ -674,9 +674,20 @@ func (q *pointerQueue) deliverEnterLeaveEvents(p *pointerInfo, events *handlerEv
|
||||
} else {
|
||||
hits = q.opHit(e.Position)
|
||||
if p.pressed {
|
||||
// Filter out non-participating handlers.
|
||||
// Filter out non-participating handlers,
|
||||
// except potential transfer targets when a transfer has been initiated.
|
||||
var transferSource *pointerHandler
|
||||
if p.dataSource != nil {
|
||||
transferSource = q.handlers[p.dataSource]
|
||||
}
|
||||
for i := len(hits) - 1; i >= 0; i-- {
|
||||
if _, found := searchTag(p.handlers, hits[i]); !found {
|
||||
tag := hits[i]
|
||||
if transferSource != nil {
|
||||
if _, ok := firstMimeMatch(transferSource, q.handlers[tag]); ok {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if _, found := searchTag(p.handlers, tag); !found {
|
||||
hits = append(hits[:i], hits[i+1:]...)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user