| 109 | ////////////////////////////////////////////////////////////////////////// |
| 110 | |
| 111 | bool checkKey( ImGuiKey passedKey ) |
| 112 | { |
| 113 | if ( passedKey == ImGuiKey_None || ImGui::GetIO().KeyMods != ImGuiMod_None ) |
| 114 | return false; |
| 115 | |
| 116 | // if modal is open ImGui::GetIO().WantCaptureKeyboard will be always true, |
| 117 | // so use special case for modals |
| 118 | bool isAnyOpen = bool( ImGui::GetTopMostPopupModal() ); |
| 119 | if ( ( isAnyOpen && ImGui::IsAnyItemActive() ) || ( !isAnyOpen && ImGui::GetIO().WantCaptureKeyboard ) ) |
| 120 | return false; |
| 121 | |
| 122 | reserveKeyEvent( passedKey ); |
| 123 | bool pressed = false; |
| 124 | if ( passedKey == ImGuiKey_Enter || passedKey == ImGuiKey_KeypadEnter ) |
| 125 | pressed = ImGui::IsKeyPressed( ImGuiKey_Enter ) || ImGui::IsKeyPressed( ImGuiKey_KeypadEnter ); |
| 126 | else |
| 127 | pressed = ImGui::IsKeyPressed( passedKey ); |
| 128 | return pressed; |
| 129 | } |
| 130 | |
| 131 | ////////////////////////////////////////////////////////////////////////// |
| 132 |
no test coverage detected