Skip to content

Commit 38fca9a

Browse files
committed
widget: show software keyboard when a writable Editor is clicked
Extracted from #138 by Inkeliz. References: https://todo.sr.ht/~eliasnaur/gio/591 Signed-off-by: Elias Naur <[email protected]>
1 parent e878dbc commit 38fca9a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

widget/editor.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ func (e *Editor) processPointerEvent(gtx layout.Context, ev event.Event) (Editor
289289
Y: int(math.Round(float64(evt.Position.Y))),
290290
})
291291
gtx.Execute(key.FocusCmd{Tag: e})
292+
if !e.ReadOnly {
293+
gtx.Execute(key.SoftKeyboardCmd{Show: true})
294+
}
292295
if e.scroller.State() != gesture.StateFlinging {
293296
e.scrollCaret = true
294297
}
@@ -395,7 +398,7 @@ func (e *Editor) processKey(gtx layout.Context) (EditorEvent, bool) {
395398
case key.FocusEvent:
396399
// Reset IME state.
397400
e.ime.imeState = imeState{}
398-
if ke.Focus {
401+
if ke.Focus && !e.ReadOnly {
399402
gtx.Execute(key.SoftKeyboardCmd{Show: true})
400403
}
401404
case key.Event:

0 commit comments

Comments
 (0)