mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
widget: show soft keyboard on focus
We're about to replace the per-widget Focus methods with the client executing FocusCmd themselves. To ensure the soft keyboard is not forgotten, ask to show it automatically on focus. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+3
-1
@@ -390,6 +390,9 @@ func (e *Editor) processKey(gtx layout.Context) {
|
|||||||
e.focused = ke.Focus
|
e.focused = ke.Focus
|
||||||
// Reset IME state.
|
// Reset IME state.
|
||||||
e.ime.imeState = imeState{}
|
e.ime.imeState = imeState{}
|
||||||
|
if ke.Focus {
|
||||||
|
gtx.Execute(key.SoftKeyboardCmd{Show: true})
|
||||||
|
}
|
||||||
case key.Event:
|
case key.Event:
|
||||||
if !e.focused || ke.State != key.Press {
|
if !e.focused || ke.State != key.Press {
|
||||||
break
|
break
|
||||||
@@ -560,7 +563,6 @@ func (e *Editor) command(gtx layout.Context, k key.Event) {
|
|||||||
// Focus requests the input focus for the Editor.
|
// Focus requests the input focus for the Editor.
|
||||||
func (e *Editor) Focus(gtx layout.Context) {
|
func (e *Editor) Focus(gtx layout.Context) {
|
||||||
gtx.Execute(key.FocusCmd{Tag: e})
|
gtx.Execute(key.FocusCmd{Tag: e})
|
||||||
gtx.Execute(key.SoftKeyboardCmd{Show: true})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Focused returns whether the editor is focused or not.
|
// Focused returns whether the editor is focused or not.
|
||||||
|
|||||||
Reference in New Issue
Block a user