Skip to content

Commit

Permalink
Merge pull request #73554 from katemonster33/android_navigation_imgui
Browse files Browse the repository at this point in the history
Fixing issue where Android gesture inputs were broken
  • Loading branch information
Maleclypse authored May 9, 2024
2 parents 88e09a5 + fab50dc commit 75f6a42
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/cata_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ void cataimgui::client::end_frame()

ImTui_ImplText_RenderDrawData( ImGui::GetDrawData() );
ImTui_ImplNcurses_DrawScreen();
ImGuiIO &io = ImGui::GetIO();
for( const int &code : cata_input_trail ) {
io.AddKeyEvent( cata_key_to_imgui( code ), false );
}
cata_input_trail.clear();
}

void cataimgui::client::upload_color_pair( int p, int f, int b )
Expand Down Expand Up @@ -261,6 +266,11 @@ void cataimgui::client::end_frame()
{
ImGui::Render();
ImGui_ImplSDLRenderer2_RenderDrawData( ImGui::GetDrawData() );
ImGuiIO &io = ImGui::GetIO();
for( const int &code : cata_input_trail ) {
io.AddKeyEvent( cata_key_to_imgui( code ), false );
}
cata_input_trail.clear();
}

void cataimgui::client::process_input( void *input )
Expand Down Expand Up @@ -328,7 +338,7 @@ void cataimgui::client::process_cata_input( const input_event &event )
int code = event.get_first_input();
ImGuiIO &io = ImGui::GetIO();
io.AddKeyEvent( cata_key_to_imgui( code ), true );
io.AddKeyEvent( cata_key_to_imgui( code ), false );
cata_input_trail.push_back( code );
}
}

Expand Down
1 change: 1 addition & 0 deletions src/cata_imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ enum class dialog_result {

class client
{
std::vector<int> cata_input_trail;
public:
#if !(defined(TILES) || defined(WIN32))
client();
Expand Down

0 comments on commit 75f6a42

Please sign in to comment.