Replace textInputSupported flag
This commit is contained in:
@@ -37,7 +37,8 @@ const (
|
||||
|
||||
type WiFiSetupPage struct {
|
||||
Base
|
||||
applicationFont *fontManager.FontEntry
|
||||
applicationFont *fontManager.FontEntry
|
||||
textInputSupported bool
|
||||
|
||||
// UI elements
|
||||
BaseFontSize int
|
||||
@@ -134,6 +135,7 @@ func (p *WiFiSetupPage) HandleEvent(event *sdl.Event) error {
|
||||
// SDL fires TextInputEvent for every printable character typed.
|
||||
// This is the correct SDL2 way — no manual keycode mapping needed.
|
||||
if p.isEnteringPassword {
|
||||
p.textInputSupported = true
|
||||
p.passwordInput += e.GetText()
|
||||
p.rebuildPasswordTexture()
|
||||
}
|
||||
@@ -158,7 +160,6 @@ func (p *WiFiSetupPage) handlePasswordKey(sym sdl.Keycode) {
|
||||
|
||||
case sdl.K_BACKSPACE:
|
||||
if len(p.passwordInput) > 0 {
|
||||
// Trim one rune safely
|
||||
runes := []rune(p.passwordInput)
|
||||
p.passwordInput = string(runes[:len(runes)-1])
|
||||
p.rebuildPasswordTexture()
|
||||
@@ -213,6 +214,7 @@ func (p *WiFiSetupPage) handleNavKey(sym sdl.Keycode) {
|
||||
func (p *WiFiSetupPage) enterPasswordMode() {
|
||||
keybinds.Enabled = false
|
||||
p.isEnteringPassword = true
|
||||
p.textInputSupported = false
|
||||
p.rebuildPasswordPromptTexture()
|
||||
p.rebuildPasswordTexture()
|
||||
sdl.StartTextInput()
|
||||
|
||||
Reference in New Issue
Block a user