Potentially fixed text input on kiosk machine

This commit is contained in:
NeilClack
2026-06-27 01:08:55 -05:00
parent 2fac3ab6a8
commit 91f3afd517
3 changed files with 8 additions and 17 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ func DownloadAudioFiles(progressChan chan<- DownloadStatus, filenames []string,
} else if err != nil { } else if err != nil {
logger.Error("unknown error: %v", err) logger.Error("unknown error: %v", err)
} else { } else {
logger.Error("File %s exists, skipping...", filename) logger.Warning("File %s exists, skipping...", filename)
totalDownloaded += fileStat.Size() totalDownloaded += fileStat.Size()
} }
// Calculate the total of ALL files to give the illusion of // Calculate the total of ALL files to give the illusion of
-2
View File
@@ -7,7 +7,6 @@ import (
"github.com/go-gl/gl/v3.3-core/gl" "github.com/go-gl/gl/v3.3-core/gl"
"github.com/go-gl/mathgl/mgl32" "github.com/go-gl/mathgl/mgl32"
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
"rhemawavetech.com/rhemawave/internal/logger"
"rhemawavetech.com/rhemawave/internal/shaderManager" "rhemawavetech.com/rhemawave/internal/shaderManager"
) )
@@ -198,7 +197,6 @@ func keycodeToChar(sym sdl.Keycode, mod uint16) rune {
if shifted { if shifted {
ch -= 'a' - 'A' ch -= 'a' - 'A'
} }
logger.Info("Wifi Password entered: %v", ch)
return ch return ch
} }
+7 -14
View File
@@ -130,22 +130,12 @@ func (p *WiFiSetupPage) startScan() {
func (p *WiFiSetupPage) HandleEvent(event *sdl.Event) error { func (p *WiFiSetupPage) HandleEvent(event *sdl.Event) error {
switch e := (*event).(type) { switch e := (*event).(type) {
case *sdl.TextInputEvent:
// 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()
}
case *sdl.KeyboardEvent: case *sdl.KeyboardEvent:
if e.Type != sdl.KEYDOWN { if e.Type != sdl.KEYDOWN {
return nil return nil
} }
if p.isEnteringPassword { if p.isEnteringPassword {
p.handlePasswordKey(e.Keysym.Sym) p.handlePasswordKey(e.Keysym.Sym, e.Keysym.Mod)
} else { } else {
p.handleNavKey(e.Keysym.Sym) p.handleNavKey(e.Keysym.Sym)
} }
@@ -153,23 +143,26 @@ func (p *WiFiSetupPage) HandleEvent(event *sdl.Event) error {
return nil return nil
} }
func (p *WiFiSetupPage) handlePasswordKey(sym sdl.Keycode) { func (p *WiFiSetupPage) handlePasswordKey(sym sdl.Keycode, mod uint16) {
switch sym { switch sym {
case sdl.K_RETURN: case sdl.K_RETURN:
p.submitPassword() p.submitPassword()
case sdl.K_BACKSPACE: case sdl.K_BACKSPACE:
if len(p.passwordInput) > 0 { if len(p.passwordInput) > 0 {
runes := []rune(p.passwordInput) runes := []rune(p.passwordInput)
p.passwordInput = string(runes[:len(runes)-1]) p.passwordInput = string(runes[:len(runes)-1])
p.rebuildPasswordTexture() p.rebuildPasswordTexture()
} }
case sdl.K_ESCAPE: case sdl.K_ESCAPE:
logger.Info("wifi: password entry cancelled") logger.Info("wifi: password entry cancelled")
p.exitPasswordMode() p.exitPasswordMode()
p.connectError = "" p.connectError = ""
p.selectedNet = nil p.selectedNet = nil
default:
if ch := keycodeToChar(sym, mod); ch != 0 {
p.passwordInput += string(ch)
p.rebuildPasswordTexture()
}
} }
} }