Skip to content

Commit

Permalink
【Frontend】Make text field alignment code common between platforms.
Browse files Browse the repository at this point in the history
  • Loading branch information
skylersaleh committed Jul 25, 2023
1 parent 0ef070b commit 6484e8a
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2928,15 +2928,6 @@ void se_android_set_keyboard_visible(bool visible){
float size = (bottom-top);
gui_state.screen_height= (bottom-top)*se_dpi_scale();

ImGuiWindow* window = igGetCurrentContext()->HoveredWindow;
if(igGetCurrentContext()->ActiveIdWindow)window=igGetCurrentContext()->ActiveIdWindow;

if (window!=NULL) {
float y = igGetCurrentContext()->PlatformImeLastPos.y+30;

if (y >= size)
igSetScrollYWindowPtr(window, window->Scroll.y + (y - size));
}
ANativeActivity* activity =(ANativeActivity*)sapp_android_get_native_activity();
// Attaches the current thread to the JVM.
JavaVM *pJavaVM = activity->vm;
Expand Down Expand Up @@ -3025,8 +3016,8 @@ void se_download_emscripten_file(const char * path){
}, name, data, data_size);
}
#endif
#ifdef PLATFORM_IOS
void se_ios_handle_soft_keyboard(){

void se_bring_text_field_into_view(){
if(sapp_keyboard_shown()){

ImGuiWindow* window = igGetCurrentContext()->HoveredWindow;
Expand All @@ -3039,7 +3030,6 @@ void se_ios_handle_soft_keyboard(){
}
}
}
#endif

int file_sorter (const void * a, const void * b) {
tinydir_file*af = (tinydir_file*)a;
Expand Down Expand Up @@ -4560,9 +4550,8 @@ static void frame(void) {
#ifdef PLATFORM_ANDROID
se_android_set_keyboard_visible(igGetIO()->WantTextInput);
#endif
#ifdef PLATFORM_IOS
se_ios_handle_soft_keyboard();
#endif

se_bring_text_field_into_view();

if (gui_state.test_runner_mode==false&&se_begin_menu_bar())
{
Expand Down

0 comments on commit 6484e8a

Please sign in to comment.