mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
all: [API] deliver events one at a time to allow fine-grained event processing
Processing one event at a time allows a widget to execute commands after the event that triggered it, instead of after all matching events. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+6
-2
@@ -65,8 +65,12 @@ func (d *Draggable) Update(gtx layout.Context) (mime string, requested bool) {
|
||||
}
|
||||
d.pos = pos
|
||||
|
||||
for _, ev := range gtx.Events(&d.handle, transfer.SourceFilter{Type: d.Type}) {
|
||||
if e, ok := ev.(transfer.RequestEvent); ok {
|
||||
for {
|
||||
e, ok := gtx.Event(&d.handle, transfer.SourceFilter{Type: d.Type})
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
if e, ok := e.(transfer.RequestEvent); ok {
|
||||
return e.Type, true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user