mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Backends: Win32, SDL: maintain MouseButtonsDown instead of using IsAnyMouseDown(). Internals: added GetInputSourceName().
This commit is contained in:
14
imgui.cpp
14
imgui.cpp
@ -7585,6 +7585,7 @@ bool ImGui::IsMousePosValid(const ImVec2* mouse_pos)
|
||||
return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID;
|
||||
}
|
||||
|
||||
// [WILL OBSOLETE] This was designed for backends, but prefer having backend maintain a mask of held mouse buttons, because upcoming input queue system will make this invalid.
|
||||
bool ImGui::IsAnyMouseDown()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@ -7642,6 +7643,13 @@ void ImGui::CaptureMouseFromApp(bool capture)
|
||||
g.WantCaptureMouseNextFrame = capture ? 1 : 0;
|
||||
}
|
||||
|
||||
static const char* GetInputSourceName(ImGuiInputSource source)
|
||||
{
|
||||
const char* input_source_names[] = { "None", "Mouse", "Keyboard", "Gamepad", "Nav", "Clipboard" };
|
||||
IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT && source >= 0 && source < ImGuiInputSource_COUNT);
|
||||
return input_source_names[source];
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] ERROR CHECKING
|
||||
@ -12107,8 +12115,6 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
// Misc Details
|
||||
if (TreeNode("Internal state"))
|
||||
{
|
||||
const char* input_source_names[] = { "None", "Mouse", "Keyboard", "Gamepad", "Nav", "Clipboard" }; IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT);
|
||||
|
||||
Text("WINDOWING");
|
||||
Indent();
|
||||
Text("HoveredWindow: '%s'", g.HoveredWindow ? g.HoveredWindow->Name : "NULL");
|
||||
@ -12119,7 +12125,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
|
||||
Text("ITEMS");
|
||||
Indent();
|
||||
Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, input_source_names[g.ActiveIdSource]);
|
||||
Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, GetInputSourceName(g.ActiveIdSource));
|
||||
Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL");
|
||||
|
||||
int active_id_using_key_input_count = 0;
|
||||
@ -12134,7 +12140,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
Indent();
|
||||
Text("NavWindow: '%s'", g.NavWindow ? g.NavWindow->Name : "NULL");
|
||||
Text("NavId: 0x%08X, NavLayer: %d", g.NavId, g.NavLayer);
|
||||
Text("NavInputSource: %s", input_source_names[g.NavInputSource]);
|
||||
Text("NavInputSource: %s", GetInputSourceName(g.NavInputSource));
|
||||
Text("NavActive: %d, NavVisible: %d", g.IO.NavActive, g.IO.NavVisible);
|
||||
Text("NavActivateId/DownId/PressedId/InputId: %08X/%08X/%08X/%08X", g.NavActivateId, g.NavActivateDownId, g.NavActivatePressedId, g.NavActivateInputId);
|
||||
Text("NavActivateFlags: %04X", g.NavActivateFlags);
|
||||
|
Reference in New Issue
Block a user