|
@@ -1270,7 +1270,7 @@ void ImGuiIO::ClearInputKeys()
|
|
|
// - float analog_value: 0.0f..1.0f
|
|
|
void ImGuiIO::AddKeyAnalogEvent(ImGuiKey key, bool down, float analog_value)
|
|
|
{
|
|
|
- //if (e->Down) { IMGUI_DEBUG_PRINT("AddKeyEvent() Key='%s' %d, NativeKeycode = %d, NativeScancode = %d\n", ImGui::GetKeyName(e->Key), e->Down, e->NativeKeycode, e->NativeScancode); }
|
|
|
+ //if (e->Down) { IMGUI_DEBUG_LOG_IO("AddKeyEvent() Key='%s' %d, NativeKeycode = %d, NativeScancode = %d\n", ImGui::GetKeyName(e->Key), e->Down, e->NativeKeycode, e->NativeScancode); }
|
|
|
if (key == ImGuiKey_None || !AppAcceptingEvents)
|
|
|
return;
|
|
|
ImGuiContext& g = *GImGui;
|
|
@@ -3386,7 +3386,8 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
|
|
g.ActiveIdIsJustActivated = (g.ActiveId != id);
|
|
|
if (g.ActiveIdIsJustActivated)
|
|
|
{
|
|
|
- IMGUI_DEBUG_LOG_ACTIVEID("[activeid] SetActiveID(0x%08X) in Window \"%s\"\n", id, window ? window->Name : "<NULL>");
|
|
|
+ IMGUI_DEBUG_LOG_ACTIVEID("SetActiveID() old:0x%08X (window \"%s\") -> new:0x%08X (window \"%s\")\n",
|
|
|
+ g.ActiveId, g.ActiveIdWindow ? g.ActiveIdWindow->Name : "", id, window ? window->Name : "");
|
|
|
g.ActiveIdTimer = 0.0f;
|
|
|
g.ActiveIdHasBeenPressedBefore = false;
|
|
|
g.ActiveIdHasBeenEditedBefore = false;
|
|
@@ -4350,9 +4351,16 @@ void ImGui::NewFrame()
|
|
|
g.HoveredIdUsingMouseWheel = false;
|
|
|
g.HoveredIdDisabled = false;
|
|
|
|
|
|
- // Update ActiveId data (clear reference to active widget if the widget isn't alive anymore)
|
|
|
- if (g.ActiveIdIsAlive != g.ActiveId && g.ActiveIdPreviousFrame == g.ActiveId && g.ActiveId != 0)
|
|
|
+ // Clear ActiveID if the item is not alive anymore.
|
|
|
+ // In 1.87, the common most call to KeepAliveID() was moved from GetID() to ItemAdd().
|
|
|
+ // As a result, custom widget using ButtonBehavior() _without_ ItemAdd() need to call KeepAliveID() themselves.
|
|
|
+ if (g.ActiveId != 0 && g.ActiveIdIsAlive != g.ActiveId && g.ActiveIdPreviousFrame == g.ActiveId)
|
|
|
+ {
|
|
|
+ IMGUI_DEBUG_LOG_ACTIVEID("NewFrame(): ClearActiveID() because it isn't marked alive anymore!\n");
|
|
|
ClearActiveID();
|
|
|
+ }
|
|
|
+
|
|
|
+ // Update ActiveId data (clear reference to active widget if the widget isn't alive anymore)
|
|
|
if (g.ActiveId)
|
|
|
g.ActiveIdTimer += g.IO.DeltaTime;
|
|
|
g.LastActiveIdTimer += g.IO.DeltaTime;
|
|
@@ -5364,7 +5372,7 @@ static void UpdateWindowInFocusOrderList(ImGuiWindow* window, bool just_created,
|
|
|
static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
- //IMGUI_DEBUG_PRINT("CreateNewWindow '%s', flags = 0x%08X\n", name, flags);
|
|
|
+ //IMGUI_DEBUG_LOG("CreateNewWindow '%s', flags = 0x%08X\n", name, flags);
|
|
|
|
|
|
// Create window the first time
|
|
|
ImGuiWindow* window = IM_NEW(ImGuiWindow)(&g, name);
|
|
@@ -7378,11 +7386,13 @@ void ImGui::PopFocusScope()
|
|
|
g.FocusScopeStack.pop_back();
|
|
|
}
|
|
|
|
|
|
+// Note: this will likely be called ActivateItem() once we rework our Focus/Activation system!
|
|
|
void ImGui::SetKeyboardFocusHere(int offset)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
IM_ASSERT(offset >= -1); // -1 is allowed but not below
|
|
|
+ IMGUI_DEBUG_LOG_ACTIVEID("SetKeyboardFocusHere(%d) in window \"%s\"\n", offset, window->Name);
|
|
|
|
|
|
SetNavWindow(window);
|
|
|
|
|
@@ -7829,12 +7839,12 @@ static const char* GetInputSourceName(ImGuiInputSource source)
|
|
|
|
|
|
/*static void DebugPrintInputEvent(const char* prefix, const ImGuiInputEvent* e)
|
|
|
{
|
|
|
- if (e->Type == ImGuiInputEventType_MousePos) { IMGUI_DEBUG_PRINT("%s: MousePos (%.1f %.1f)\n", prefix, e->MousePos.PosX, e->MousePos.PosY); return; }
|
|
|
- if (e->Type == ImGuiInputEventType_MouseButton) { IMGUI_DEBUG_PRINT("%s: MouseButton %d %s\n", prefix, e->MouseButton.Button, e->MouseButton.Down ? "Down" : "Up"); return; }
|
|
|
- if (e->Type == ImGuiInputEventType_MouseWheel) { IMGUI_DEBUG_PRINT("%s: MouseWheel (%.1f %.1f)\n", prefix, e->MouseWheel.WheelX, e->MouseWheel.WheelY); return; }
|
|
|
- if (e->Type == ImGuiInputEventType_Key) { IMGUI_DEBUG_PRINT("%s: Key \"%s\" %s\n", prefix, ImGui::GetKeyName(e->Key.Key), e->Key.Down ? "Down" : "Up"); return; }
|
|
|
- if (e->Type == ImGuiInputEventType_Text) { IMGUI_DEBUG_PRINT("%s: Text: %c (U+%08X)\n", prefix, e->Text.Char, e->Text.Char); return; }
|
|
|
- if (e->Type == ImGuiInputEventType_Focus) { IMGUI_DEBUG_PRINT("%s: AppFocused %d\n", prefix, e->AppFocused.Focused); return; }
|
|
|
+ if (e->Type == ImGuiInputEventType_MousePos) { IMGUI_DEBUG_LOG_IO("%s: MousePos (%.1f %.1f)\n", prefix, e->MousePos.PosX, e->MousePos.PosY); return; }
|
|
|
+ if (e->Type == ImGuiInputEventType_MouseButton) { IMGUI_DEBUG_LOG_IO("%s: MouseButton %d %s\n", prefix, e->MouseButton.Button, e->MouseButton.Down ? "Down" : "Up"); return; }
|
|
|
+ if (e->Type == ImGuiInputEventType_MouseWheel) { IMGUI_DEBUG_LOG_IO("%s: MouseWheel (%.1f %.1f)\n", prefix, e->MouseWheel.WheelX, e->MouseWheel.WheelY); return; }
|
|
|
+ if (e->Type == ImGuiInputEventType_Key) { IMGUI_DEBUG_LOG_IO("%s: Key \"%s\" %s\n", prefix, ImGui::GetKeyName(e->Key.Key), e->Key.Down ? "Down" : "Up"); return; }
|
|
|
+ if (e->Type == ImGuiInputEventType_Text) { IMGUI_DEBUG_LOG_IO("%s: Text: %c (U+%08X)\n", prefix, e->Text.Char, e->Text.Char); return; }
|
|
|
+ if (e->Type == ImGuiInputEventType_Focus) { IMGUI_DEBUG_LOG_IO("%s: AppFocused %d\n", prefix, e->AppFocused.Focused); return; }
|
|
|
}*/
|
|
|
|
|
|
// Process input queue
|
|
@@ -7954,7 +7964,7 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs)
|
|
|
}
|
|
|
|
|
|
// Record trail (for domain-specific applications wanting to access a precise trail)
|
|
|
- //if (event_n != 0) IMGUI_DEBUG_PRINT("Processed: %d / Remaining: %d\n", event_n, g.InputEventsQueue.Size - event_n);
|
|
|
+ //if (event_n != 0) IMGUI_DEBUG_LOG_IO("Processed: %d / Remaining: %d\n", event_n, g.InputEventsQueue.Size - event_n);
|
|
|
for (int n = 0; n < event_n; n++)
|
|
|
g.InputEventsTrail.push_back(g.InputEventsQueue[n]);
|
|
|
|
|
@@ -10318,7 +10328,7 @@ static void ImGui::NavUpdate()
|
|
|
{
|
|
|
io.MousePos = io.MousePosPrev = NavCalcPreferredRefPos();
|
|
|
io.WantSetMousePos = true;
|
|
|
- //IMGUI_DEBUG_PRINT("SetMousePos: (%.1f,%.1f)\n", io.MousePos.x, io.MousePos.y);
|
|
|
+ //IMGUI_DEBUG_LOG_IO("SetMousePos: (%.1f,%.1f)\n", io.MousePos.x, io.MousePos.y);
|
|
|
}
|
|
|
|
|
|
// [DEBUG]
|
|
@@ -11027,6 +11037,12 @@ void ImGui::NavUpdateWindowingOverlay()
|
|
|
// [SECTION] DRAG AND DROP
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
+bool ImGui::IsDragDropActive()
|
|
|
+{
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
+ return g.DragDropActive;
|
|
|
+}
|
|
|
+
|
|
|
void ImGui::ClearDragDrop()
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
@@ -13125,8 +13141,11 @@ void ImGui::DebugLog(const char* fmt, ...)
|
|
|
void ImGui::DebugLogV(const char* fmt, va_list args)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
+ const int old_size = g.DebugLogBuf.size();
|
|
|
g.DebugLogBuf.appendf("[%05d] ", g.FrameCount);
|
|
|
g.DebugLogBuf.appendfv(fmt, args);
|
|
|
+ if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY)
|
|
|
+ IMGUI_DEBUG_PRINTF("%s", g.DebugLogBuf.begin() + old_size);
|
|
|
}
|
|
|
|
|
|
void ImGui::ShowDebugLogWindow(bool* p_open)
|