Skip to content

Commit

Permalink
widget: show software keyboard when a writable Editor is clicked
Browse files Browse the repository at this point in the history
Extracted from #138 by Inkeliz.

References: https://todo.sr.ht/~eliasnaur/gio/591
Signed-off-by: Elias Naur <[email protected]>
  • Loading branch information
eliasnaur committed Jun 16, 2024
1 parent e878dbc commit 38fca9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion widget/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ func (e *Editor) processPointerEvent(gtx layout.Context, ev event.Event) (Editor
Y: int(math.Round(float64(evt.Position.Y))),
})
gtx.Execute(key.FocusCmd{Tag: e})
if !e.ReadOnly {
gtx.Execute(key.SoftKeyboardCmd{Show: true})
}
if e.scroller.State() != gesture.StateFlinging {
e.scrollCaret = true
}
Expand Down Expand Up @@ -395,7 +398,7 @@ func (e *Editor) processKey(gtx layout.Context) (EditorEvent, bool) {
case key.FocusEvent:
// Reset IME state.
e.ime.imeState = imeState{}
if ke.Focus {
if ke.Focus && !e.ReadOnly {
gtx.Execute(key.SoftKeyboardCmd{Show: true})
}
case key.Event:
Expand Down

0 comments on commit 38fca9a

Please sign in to comment.