Merge pull request 'Replace textInputSupported flag' (#45) from no-text-input-for-wifi-password into dev
Reviewed-on: https://codeberg.org/RhemaWave-Technologies/RhemaWave/pulls/45
This commit is contained in:
@@ -38,6 +38,7 @@ const (
|
|||||||
type WiFiSetupPage struct {
|
type WiFiSetupPage struct {
|
||||||
Base
|
Base
|
||||||
applicationFont *fontManager.FontEntry
|
applicationFont *fontManager.FontEntry
|
||||||
|
textInputSupported bool
|
||||||
|
|
||||||
// UI elements
|
// UI elements
|
||||||
BaseFontSize int
|
BaseFontSize int
|
||||||
@@ -134,6 +135,7 @@ func (p *WiFiSetupPage) HandleEvent(event *sdl.Event) error {
|
|||||||
// SDL fires TextInputEvent for every printable character typed.
|
// SDL fires TextInputEvent for every printable character typed.
|
||||||
// This is the correct SDL2 way — no manual keycode mapping needed.
|
// This is the correct SDL2 way — no manual keycode mapping needed.
|
||||||
if p.isEnteringPassword {
|
if p.isEnteringPassword {
|
||||||
|
p.textInputSupported = true
|
||||||
p.passwordInput += e.GetText()
|
p.passwordInput += e.GetText()
|
||||||
p.rebuildPasswordTexture()
|
p.rebuildPasswordTexture()
|
||||||
}
|
}
|
||||||
@@ -158,7 +160,6 @@ func (p *WiFiSetupPage) handlePasswordKey(sym sdl.Keycode) {
|
|||||||
|
|
||||||
case sdl.K_BACKSPACE:
|
case sdl.K_BACKSPACE:
|
||||||
if len(p.passwordInput) > 0 {
|
if len(p.passwordInput) > 0 {
|
||||||
// Trim one rune safely
|
|
||||||
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()
|
||||||
@@ -213,6 +214,7 @@ func (p *WiFiSetupPage) handleNavKey(sym sdl.Keycode) {
|
|||||||
func (p *WiFiSetupPage) enterPasswordMode() {
|
func (p *WiFiSetupPage) enterPasswordMode() {
|
||||||
keybinds.Enabled = false
|
keybinds.Enabled = false
|
||||||
p.isEnteringPassword = true
|
p.isEnteringPassword = true
|
||||||
|
p.textInputSupported = false
|
||||||
p.rebuildPasswordPromptTexture()
|
p.rebuildPasswordPromptTexture()
|
||||||
p.rebuildPasswordTexture()
|
p.rebuildPasswordTexture()
|
||||||
sdl.StartTextInput()
|
sdl.StartTextInput()
|
||||||
|
|||||||
Reference in New Issue
Block a user