Clipper: Assert on extraneous calls to Step(). (#4822) + Demo tweak.

This commit is contained in:
ocornut 2022-02-18 18:39:29 +01:00
parent 29d462ebce
commit dca527be1b
3 changed files with 16 additions and 11 deletions

View File

@ -2599,6 +2599,7 @@ bool ImGuiListClipper::Step()
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
ImGuiWindow* window = g.CurrentWindow; ImGuiWindow* window = g.CurrentWindow;
ImGuiListClipperData* data = (ImGuiListClipperData*)TempData; ImGuiListClipperData* data = (ImGuiListClipperData*)TempData;
IM_ASSERT(data != NULL && "Called ImGuiListClipper::Step() too many times, or before ImGuiListClipper::Begin() ?");
ImGuiTable* table = g.CurrentTable; ImGuiTable* table = g.CurrentTable;
if (table && table->IsInsideRow) if (table && table->IsInsideRow)

View File

@ -1422,7 +1422,7 @@ enum ImGuiKey_
ImGuiKey_GamepadRStickLeft, // [Analog] ImGuiKey_GamepadRStickLeft, // [Analog]
ImGuiKey_GamepadRStickRight, // [Analog] ImGuiKey_GamepadRStickRight, // [Analog]
// Keyboard Modifiers // Keyboard Modifiers (explicitly submitted by backend via AddKeyEvent() calls)
// - This is mirroring the data also written to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper, in a format allowing // - This is mirroring the data also written to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper, in a format allowing
// them to be accessed via standard key API, allowing calls such as IsKeyPressed(), IsKeyReleased(), querying duration etc. // them to be accessed via standard key API, allowing calls such as IsKeyPressed(), IsKeyReleased(), querying duration etc.
// - Code polling every keys (e.g. an interface to detect a key press for input mapping) might want to ignore those // - Code polling every keys (e.g. an interface to detect a key press for input mapping) might want to ignore those
@ -1430,11 +1430,9 @@ enum ImGuiKey_
// - In theory the value of keyboard modifiers should be roughly equivalent to a logical or of the equivalent left/right keys. // - In theory the value of keyboard modifiers should be roughly equivalent to a logical or of the equivalent left/right keys.
// In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and // In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and
// backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user... // backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
ImGuiKey_ModCtrl, ImGuiKey_ModCtrl, ImGuiKey_ModShift, ImGuiKey_ModAlt, ImGuiKey_ModSuper,
ImGuiKey_ModShift,
ImGuiKey_ModAlt,
ImGuiKey_ModSuper,
// End of list
ImGuiKey_COUNT, // No valid ImGuiKey is ever greater than this value ImGuiKey_COUNT, // No valid ImGuiKey is ever greater than this value
// [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + a io.KeyMap[] array. // [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + a io.KeyMap[] array.

View File

@ -5666,12 +5666,18 @@ static void ShowDemoWindowMisc()
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
// Display ImGuiIO output flags // Display ImGuiIO output flags
ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse); IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Output");
ImGui::Text("WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose); ImGui::SetNextItemOpen(true, ImGuiCond_Once);
ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard); if (ImGui::TreeNode("Output"))
ImGui::Text("WantTextInput: %d", io.WantTextInput); {
ImGui::Text("WantSetMousePos: %d", io.WantSetMousePos); ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse);
ImGui::Text("NavActive: %d, NavVisible: %d", io.NavActive, io.NavVisible); ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose);
ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
ImGui::Text("io.WantTextInput: %d", io.WantTextInput);
ImGui::Text("io.WantSetMousePos: %d", io.WantSetMousePos);
ImGui::Text("io.NavActive: %d, io.NavVisible: %d", io.NavActive, io.NavVisible);
ImGui::TreePop();
}
// Display Mouse state // Display Mouse state
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Mouse State"); IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Mouse State");