Fix input
This commit is contained in:
@@ -170,17 +170,14 @@ func (p *WiFiSetupPage) HandleEvent(event *sdl.Event) error {
|
|||||||
|
|
||||||
case *sdl.TextInputEvent:
|
case *sdl.TextInputEvent:
|
||||||
if p.isEnteringPassword {
|
if p.isEnteringPassword {
|
||||||
text := e.GetText()
|
// If we get a TextInputEvent, the system supports high-level input.
|
||||||
|
// Mark it supported so we don't double-type from KeyboardEvents.
|
||||||
// Append text exactly as SDL delivers it
|
if !p.textInputSupported {
|
||||||
p.passwordInput += text
|
p.textInputSupported = true
|
||||||
|
} else {
|
||||||
// Log every character
|
p.passwordInput += e.GetText()
|
||||||
for _, r := range text {
|
p.updatePasswordTexture()
|
||||||
logger.Info("WiFi Password character entered: %c", r)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p.updatePasswordTexture()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case *sdl.KeyboardEvent:
|
case *sdl.KeyboardEvent:
|
||||||
@@ -189,7 +186,8 @@ func (p *WiFiSetupPage) HandleEvent(event *sdl.Event) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if p.isEnteringPassword {
|
if p.isEnteringPassword {
|
||||||
p.handlePasswordInput(e.Keysym.Sym)
|
// Pass the Modifiers (Shift/Caps) to the handler
|
||||||
|
p.handlePasswordInput(e.Keysym.Sym, e.Keysym.Mod)
|
||||||
} else {
|
} else {
|
||||||
p.handleNetworkSelection(e.Keysym.Sym)
|
p.handleNetworkSelection(e.Keysym.Sym)
|
||||||
}
|
}
|
||||||
@@ -199,7 +197,9 @@ func (p *WiFiSetupPage) HandleEvent(event *sdl.Event) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handlePasswordInput manages keyboard events during password entry.
|
// handlePasswordInput manages keyboard events during password entry.
|
||||||
func (p *WiFiSetupPage) handlePasswordInput(sym sdl.Keycode) {
|
// Update the signature to include mod
|
||||||
|
// handlePasswordInput manages keyboard events during password entry.
|
||||||
|
func (p *WiFiSetupPage) handlePasswordInput(sym sdl.Keycode, mod uint16) {
|
||||||
switch sym {
|
switch sym {
|
||||||
|
|
||||||
case sdl.K_RETURN:
|
case sdl.K_RETURN:
|
||||||
@@ -228,11 +228,21 @@ func (p *WiFiSetupPage) handlePasswordInput(sym sdl.Keycode) {
|
|||||||
|
|
||||||
case sdl.K_ESCAPE:
|
case sdl.K_ESCAPE:
|
||||||
logger.Info("WiFi Password entry cancelled")
|
logger.Info("WiFi Password entry cancelled")
|
||||||
|
|
||||||
p.isEnteringPassword = false
|
p.isEnteringPassword = false
|
||||||
p.pendingSSID = ""
|
p.pendingSSID = ""
|
||||||
p.connectionError = ""
|
p.connectionError = ""
|
||||||
p.exitPasswordMode()
|
p.exitPasswordMode()
|
||||||
|
|
||||||
|
default:
|
||||||
|
// FALLBACK: If the kiosk environment doesn't fire TextInputEvents,
|
||||||
|
// manually convert keycodes to characters.
|
||||||
|
if !p.textInputSupported {
|
||||||
|
if ch := keycodeToChar(sym, mod); ch != 0 {
|
||||||
|
p.passwordInput += string(ch)
|
||||||
|
logger.Info("Manual character fallback: %c", ch)
|
||||||
|
p.updatePasswordTexture()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user