love.textinput
is fragile on iOS. Various things can cause an app to
stop receiving textinput events. Resizing the window is one reliable
way, but there's also another ghost, something that's triggering on
every frame of LÖVE.
Fortunately, it looks like love.keyboard.setTextInput(true)
reliably
resubscribes the app to textinput events, regardless of their cause.
https://github.com/love2d/love/issues/1959
The one remaining open question here is why the call in
App.keychord_press
(equivalent to love.keypressed
) doesn't fix the
breakage caused by the initial window resize (that happens before any
keys are pressed). I've confirmed that keypressed
comes before
textinput
on iOS just like everywhere else.
GVOLLPQFFP5G7KCCSCPH42ZHGA5BORMTYN63FUNPXWW7FUK5OW2AC
QRUFNFPP3EDJDYTAJGUTY6CVIGNKNTSF53YN22RRVMHXDO6MUJOQC
75BKRBP3XP5LNAI7JX3RTR7Q6TT4ODRSJLMTAUEW6MABSJD5MMGAC
5HGOGEZ37KPH5IW2TWPRQGL4QJEEFIHI4UC3Z3PIPIJG7QWQ5EYQC
36Z442IVPXHZ7D2QI26YLN3TDDEMDRQ2GKBYQAD6NUHQZVCCY4VAC
TVCPXAAU4P3K5MFYINH2MWDK3KGTQ2GE74TUNERYOONG2G5EYKMQC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
2CTN2IEF4ZCVZQORAEBXAUDANF6NYZA24GQ5PXK2WUDWYU5UV25QC
JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC
T7QIIGQ6YYTTYCVHVEAZSUQ3O4LYBHGPFL4K6D5TA4BA7PND4EJQC
UZHSWA3DU3BPK6AGNIVZUEGPRTHIBA7SSX4DRUN3K4D42KNNN4YQC
JNJ4R56X3HVU4IGKZZ2IV73PALEXSYOIOAIVXZTV43BG7PEY6AOQC
3QNOKBFMKBGXBVJIRHR2444JRRMBTABHE4674NR3DT67RRM2X6GAC
love.keyboard.setTextInput(true) -- magic. keeps iOS from losing textinput events after switching apps.
if OS == 'iOS' then
love.keyboard.setTextInput(true) -- magic. iOS is prone to losing textinput events.
-- https://github.com/love2d/love/issues/1959
end
App.screen.resize = love.window.setMode
App.screen.resize = function(width, height, flags)
love.window.setMode(width, height, flags)
if OS == 'iOS' then
love.keyboard.setTextInput(true) -- magic. iOS seems to lose textinput events after calls to setMode.
-- https://github.com/love2d/love/issues/1959
end
end