Skip to content

Commit 7352d86

Browse files
committed
Add backwards compatibility for Dear ImGui versions < 1.90.7
1 parent 44ee383 commit 7352d86

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

textselect.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,15 @@ void TextSelect::update() {
294294

295295
drawSelection(cursorPosStart);
296296

297+
// Backwards compatibility for Dear ImGui < v1.90.7
298+
// To be removed after 2-3 Dear ImGui updates.
299+
#if IMGUI_VERSION_NUM >= 19070
300+
ImGuiKey keyCtrl = ImGuiMod_Ctrl;
301+
#else
302+
ImGuiKey keyCtrl = ImGuiMod_Shortcut;
303+
#endif
304+
297305
// Keyboard shortcuts
298-
if (ImGui::Shortcut(ImGuiMod_Ctrl | ImGuiKey_A)) selectAll();
299-
else if (ImGui::Shortcut(ImGuiMod_Ctrl | ImGuiKey_C)) copy();
306+
if (ImGui::Shortcut(keyCtrl | ImGuiKey_A)) selectAll();
307+
else if (ImGui::Shortcut(keyCtrl | ImGuiKey_C)) copy();
300308
}

0 commit comments

Comments
 (0)