mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 08:55:35 +00:00
io/input: [API] execute commands immediately
Change the semantics of commands to execute immediately. In cases where execution of a command introduces a inconsistency, freeze event routing and defer the command as well as queued events to the next frame. Rename Source.Queue to Source.Execute to better fit the new command semantics. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+2
-2
@@ -80,7 +80,7 @@ func (b *Clickable) Pressed() bool {
|
||||
|
||||
// Focus requests the input focus for the element.
|
||||
func (b *Clickable) Focus(gtx layout.Context) {
|
||||
gtx.Queue(key.FocusCmd{Tag: &b.keyTag})
|
||||
gtx.Execute(key.FocusCmd{Tag: &b.keyTag})
|
||||
}
|
||||
|
||||
// Focused reports whether b has focus.
|
||||
@@ -149,7 +149,7 @@ func (b *Clickable) Update(gtx layout.Context) []Click {
|
||||
}
|
||||
case gesture.KindPress:
|
||||
if e.Source == pointer.Mouse {
|
||||
gtx.Queue(key.FocusCmd{Tag: &b.keyTag})
|
||||
gtx.Execute(key.FocusCmd{Tag: &b.keyTag})
|
||||
}
|
||||
b.history = append(b.history, Press{
|
||||
Position: e.Position,
|
||||
|
||||
Reference in New Issue
Block a user