Add text input on mobile

This commit is contained in:
elasota
2020-11-02 22:06:38 -05:00
parent 2ab1416eef
commit 0d5db76492
7 changed files with 47 additions and 2 deletions

View File

@@ -912,6 +912,8 @@ private:
uint8_t m_paletteStorage[256 * 4 + GP_SYSTEM_MEMORY_ALIGNMENT];
uint8_t *m_paletteData;
bool m_textInputEnabled;
};
@@ -1205,6 +1207,7 @@ GpDisplayDriver_SDL_GL2::GpDisplayDriver_SDL_GL2(const GpDisplayDriverProperties
, m_contextLost(true)
, m_lastSurface(nullptr)
, m_firstSurface(nullptr)
, m_textInputEnabled(false)
{
m_bgColor[0] = 0.f;
m_bgColor[1] = 0.f;
@@ -1915,7 +1918,6 @@ void GpDisplayDriver_SDL_GL2::Run()
}
TranslateSDLMessage(&msg, m_properties.m_eventQueue, m_pixelScaleX, m_pixelScaleY, obstructiveTextInput);
}
else
{
@@ -1937,7 +1939,6 @@ void GpDisplayDriver_SDL_GL2::Run()
int clientHeight = 0;
SDL_GetWindowSize(m_window, &clientWidth, &clientHeight);
unsigned int desiredWidth = clientWidth;
unsigned int desiredHeight = clientHeight;
if (desiredWidth != m_windowWidthPhysical || desiredHeight != m_windowHeightPhysical || m_isResolutionResetDesired)
@@ -2011,6 +2012,16 @@ void GpDisplayDriver_SDL_GL2::Run()
continue;
}
bool wantTextInput = m_properties.m_systemServices->IsTextInputEnabled();
if (wantTextInput != m_textInputEnabled)
{
m_textInputEnabled = wantTextInput;
if (m_textInputEnabled)
SDL_StartTextInput();
else
SDL_StopTextInput();
}
GpDisplayDriverTickStatus_t tickStatus = PresentFrameAndSync();
if (tickStatus == GpDisplayDriverTickStatuses::kFatalFault || tickStatus == GpDisplayDriverTickStatuses::kApplicationTerminated)
{