mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 00:45:35 +00:00
io/key: improve InputOp focus and blur
The existing implementation cannot remove the focus of some widget, doesn't have an option to focus without display the on-screen keyboard and it automatically focuses the first InputOp, aggressively. That change aims to make possible: remove focus from any widget. Add focus without displaying the on-screen-keyboard/soft keyboard. Don't automatically focus any widget. Don't recover focus when the widget is visible again. Fixes gio#180. Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
+5
-1
@@ -399,7 +399,11 @@ func (e *Editor) layout(gtx layout.Context) layout.Dimensions {
|
||||
e.shapes = append(e.shapes, line{off, path})
|
||||
}
|
||||
|
||||
key.InputOp{Tag: &e.eventKey, Focus: e.requestFocus}.Add(gtx.Ops)
|
||||
key.InputOp{Tag: &e.eventKey}.Add(gtx.Ops)
|
||||
if e.requestFocus {
|
||||
key.FocusOp{Focus: true}.Add(gtx.Ops)
|
||||
key.SoftKeyboardOp{Show: true}.Add(gtx.Ops)
|
||||
}
|
||||
e.requestFocus = false
|
||||
pointerPadding := gtx.Px(unit.Dp(4))
|
||||
r := image.Rectangle{Max: e.viewSize}
|
||||
|
||||
Reference in New Issue
Block a user