mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
widget: treat enter and space as clicks on release, not press
Matches the usual behaviour of GUI toolkits. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-1
@@ -164,7 +164,7 @@ func (b *Clickable) update(gtx layout.Context) {
|
||||
case key.FocusEvent:
|
||||
b.focused = e.Focus
|
||||
case key.Event:
|
||||
if e.State != key.Press {
|
||||
if e.State != key.Release {
|
||||
break
|
||||
}
|
||||
if e.Name != key.NameReturn && e.Name != key.NameSpace {
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ func (e *Enum) Layout(gtx layout.Context, k string, content layout.Widget) layou
|
||||
e.focused = false
|
||||
}
|
||||
case key.Event:
|
||||
if ev.State != key.Press {
|
||||
if ev.State != key.Release {
|
||||
break
|
||||
}
|
||||
if ev.Name != key.NameEnter && ev.Name != key.NameSpace {
|
||||
|
||||
Reference in New Issue
Block a user