fix: (partially) android backspace
This commit is contained in:
@@ -141,6 +141,11 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
|
||||
case SDL_KEYUP:
|
||||
{
|
||||
int key = event->key.keysym.scancode;
|
||||
if (key == SDLK_BACKSPACE) {
|
||||
io.KeysDown[key] = true;
|
||||
} else {
|
||||
io.KeysDown[key] = (event->type == SDL_KEYDOWN);
|
||||
}
|
||||
IM_ASSERT(key >= 0 && key < IM_ARRAYSIZE(io.KeysDown));
|
||||
io.KeysDown[key] = (event->type == SDL_KEYDOWN);
|
||||
io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
|
||||
@@ -162,6 +167,18 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// activating screen keyboard for Android devices
|
||||
#ifdef __ANDROID__
|
||||
static bool keyboardShown = false;
|
||||
if(ImGui::GetIO().WantTextInput != keyboardShown){
|
||||
if(ImGui::GetIO().WantTextInput){
|
||||
SDL_StartTextInput();
|
||||
}else{
|
||||
SDL_StopTextInput();
|
||||
}
|
||||
keyboardShown = ImGui::GetIO().WantTextInput;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user