Merge pull request #19838 from hrydgard/sdl-imgui-keyboard-fix

SDL: Enable KEY_CHAR processing when imgui is active
This commit is contained in:
Henrik Rydgård 2025-01-09 15:41:24 +01:00 committed by GitHub
commit 5431bb35fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 1 deletions

View file

@ -497,6 +497,9 @@ void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) {
UI::EnableFocusMovement(false);
RecreateViews();
SetExtraAssertInfo(extraAssertInfoStr_.c_str());
// Make sure we re-enable keyboard mode if it was disabled by the dialog, and if needed.
lastImguiEnabled_ = false;
}
static void AfterSaveStateAction(SaveState::Status status, std::string_view message, void *) {
@ -1658,6 +1661,14 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
}
void EmuScreen::runImDebugger() {
if (!lastImguiEnabled_ && g_Config.bShowImDebugger) {
System_NotifyUIEvent(UIEventNotification::TEXT_GOTFOCUS);
INFO_LOG(Log::System, "activating keyboard");
} else if (lastImguiEnabled_ && !g_Config.bShowImDebugger) {
System_NotifyUIEvent(UIEventNotification::TEXT_LOSTFOCUS);
INFO_LOG(Log::System, "deactivating keyboard");
}
lastImguiEnabled_ = g_Config.bShowImDebugger;
if (g_Config.bShowImDebugger) {
Draw::DrawContext *draw = screenManager()->getDrawContext();
if (!imguiInited_) {

View file

@ -142,6 +142,8 @@ private:
bool keyShiftRight_ = false;
bool keyAltLeft_ = false;
bool keyAltRight_ = false;
bool lastImguiEnabled_ = false;
};
bool MustRunBehind();

View file

@ -262,7 +262,7 @@ void ImGePixelViewer::UpdateTexture(Draw::DrawContext *draw) {
texture_ = nullptr;
}
if (!Memory::IsValid4AlignedAddress(addr) || width == 0 || height == 0 || stride > 1024 || stride == 0) {
INFO_LOG(Log::GeDebugger, "PixelViewer: Bad texture params");
// TODO: Show a warning triangle or something.
return;
}
@ -401,6 +401,8 @@ bool ImGeReadbackViewer::Draw(GPUDebugInterface *gpuDebug, Draw::DrawContext *dr
readbackFmt_ = Draw::DataFormat::S8;
rbBpp = 1;
break;
default:
break;
}
data_ = new uint8_t[w * h * rbBpp];