GUI: work around Android backspace issue

This commit is contained in:
tildearrow 2022-11-05 18:17:54 -05:00
parent a4fe7ddb76
commit ce08a62548
4 changed files with 28 additions and 1 deletions

View File

@ -244,6 +244,14 @@ void FurnaceGUI::drawMobileControls() {
mobileMenuOpen=false;
}
ImGui::SameLine();
if (ImGui::Button("Log")) {
logOpen=!logOpen;
}
ImGui::SameLine();
if (ImGui::Button("Debug")) {
debugOpen=!debugOpen;
}
ImGui::SameLine();
if (ImGui::Button("About")) {
mobileMenuOpen=false;
mobileMenuPos=0.0f;

View File

@ -2977,6 +2977,10 @@ bool FurnaceGUI::loop() {
}
eventTimeBegin=SDL_GetPerformanceCounter();
bool updateWindow=false;
if (injectBackUp) {
ImGui::GetIO().AddKeyEvent(ImGuiKey_Backspace,false);
injectBackUp=false;
}
while (SDL_PollEvent(&ev)) {
WAKE_UP;
ImGui_ImplSDL2_ProcessEvent(&ev);
@ -3039,6 +3043,9 @@ bool FurnaceGUI::loop() {
if (!ImGui::GetIO().WantCaptureKeyboard) {
keyDown(ev);
}
#ifdef IS_MOBILE
injectBackUp=true;
#endif
break;
case SDL_KEYUP:
// for now
@ -3738,6 +3745,10 @@ bool FurnaceGUI::loop() {
drawPiano();
break;
}
globalWinFlags=0;
drawDebug();
drawLog();
} else {
globalWinFlags=0;
ImGui::DockSpaceOverViewport(NULL,lockLayout?(ImGuiDockNodeFlags_NoWindowMenuButton|ImGuiDockNodeFlags_NoMove|ImGuiDockNodeFlags_NoResize|ImGuiDockNodeFlags_NoCloseButton|ImGuiDockNodeFlags_NoDocking|ImGuiDockNodeFlags_NoDockingSplitMe|ImGuiDockNodeFlags_NoDockingSplitOther):0);
@ -5441,6 +5452,7 @@ FurnaceGUI::FurnaceGUI():
vgmExportPatternHints(false),
vgmExportDirectStream(false),
portrait(false),
injectBackUp(false),
mobileMenuOpen(false),
wantCaptureKeyboard(false),
oldWantCaptureKeyboard(false),

View File

@ -1036,7 +1036,7 @@ class FurnaceGUI {
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, zsmExportLoop, vgmExportPatternHints;
bool vgmExportDirectStream;
bool portrait, mobileMenuOpen;
bool portrait, injectBackUp, mobileMenuOpen;
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex;

View File

@ -317,6 +317,13 @@ void reportError(String what) {
logE("%s",what);
MessageBox(NULL,what.c_str(),"Furnace",MB_OK|MB_ICONERROR);
}
#elif defined(ANDROID)
void reportError(String what) {
logE("%s",what);
#ifdef HAVE_SDL2
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,"Error",what.c_str(),NULL);
#endif
}
#else
void reportError(String what) {
logE("%s",what);