From bc0319e7ed804bcccf4be9e54803eed2dcbd3f61 Mon Sep 17 00:00:00 2001 From: w1naenator Date: Thu, 27 Mar 2025 16:40:44 +0200 Subject: [PATCH] Fix crash on Shift press. --- src/core/libraries/ime/ime_dialog_ui.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/libraries/ime/ime_dialog_ui.cpp b/src/core/libraries/ime/ime_dialog_ui.cpp index c1a10400f..c3de3f99f 100644 --- a/src/core/libraries/ime/ime_dialog_ui.cpp +++ b/src/core/libraries/ime/ime_dialog_ui.cpp @@ -372,6 +372,7 @@ void ImeDialogUi::DrawKeyboard() { ImGui::NewLine(); }; + // SHIFT status label if (shift_enabled) { SetCursorPosX(20.0f); TextColored(ImVec4(0.2f, 0.6f, 1.0f, 1.0f), "SHIFT ENABLED"); @@ -383,14 +384,16 @@ void ImeDialogUi::DrawKeyboard() { SetCursorPosX(20.0f); - if (shift_enabled) + // Fix: safely push/pop style only if shift was enabled before clicking + bool highlight = shift_enabled; + if (highlight) PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 1.0f, 1.0f)); if (Button("SHIFT", ImVec2(75, 35))) { shift_enabled = !shift_enabled; } - if (shift_enabled) + if (highlight) PopStyleColor(); SameLine(); @@ -425,6 +428,7 @@ void ImeDialogUi::DrawKeyboard() { } + int ImeDialogUi::InputTextCallback(ImGuiInputTextCallbackData* data) { ImeDialogUi* ui = static_cast(data->UserData); ASSERT(ui);