mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-28 14:20:30 +00:00
ImGuiOverlays: Fix display with only GPU/latency stats
This commit is contained in:
parent
61f3f86bbc
commit
7f066c2864
@ -948,6 +948,7 @@ enum ImGuiItemFlagsPrivate_
|
||||
ImGuiItemFlags_AllowOverlap = 1 << 14, // false // Allow being overlapped by another widget. Not-hovered to Hovered transition deferred by a frame.
|
||||
ImGuiItemFlags_NoNavDisableMouseHover = 1 << 15, // false // Nav keyboard/gamepad mode doesn't disable hover highlight (behave as if NavHighlightItemUnderNav==false).
|
||||
ImGuiItemFlags_NoMarkEdited = 1 << 16, // false // Skip calling MarkItemEdited()
|
||||
ImGuiItemFlags_NoFocus = 1 << 17, // false // [EXPERIMENTAL: Not very well specced] Clicking doesn't take focus. Automatically sets ImGuiButtonFlags_NoFocus + ImGuiButtonFlags_NoNavFocus in ButtonBehavior().
|
||||
|
||||
// Controlled by widget code
|
||||
ImGuiItemFlags_Inputable = 1 << 20, // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature.
|
||||
@ -1025,6 +1026,7 @@ enum ImGuiButtonFlagsPrivate_
|
||||
ImGuiButtonFlags_NoHoveredOnFocus = 1 << 19, // don't report as hovered when nav focus is on this item
|
||||
ImGuiButtonFlags_NoSetKeyOwner = 1 << 20, // don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
||||
ImGuiButtonFlags_NoTestKeyOwner = 1 << 21, // don't test key/input owner when polling the key (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
||||
ImGuiButtonFlags_NoFocus = 1 << 22, // [EXPERIMENTAL: Not very well specced]. Don't focus parent window when clicking.
|
||||
ImGuiButtonFlags_PressedOnMask_ = ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_PressedOnDragDropHold,
|
||||
ImGuiButtonFlags_PressedOnDefault_ = ImGuiButtonFlags_PressedOnClickRelease,
|
||||
};
|
||||
|
@ -4483,12 +4483,15 @@ static void SetCurrentWindow(ImGuiWindow* window)
|
||||
g.CurrentDpiScale = 1.0f; // FIXME-DPI: WIP this is modified in docking
|
||||
if (window)
|
||||
{
|
||||
bool backup_skip_items = window->SkipItems;
|
||||
window->SkipItems = false;
|
||||
if (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasTextures)
|
||||
{
|
||||
ImGuiViewport* viewport = window->Viewport;
|
||||
g.FontRasterizerDensity = (viewport->FramebufferScale.x != 0.0f) ? viewport->FramebufferScale.x : g.IO.DisplayFramebufferScale.x; // == SetFontRasterizerDensity()
|
||||
}
|
||||
ImGui::UpdateCurrentFontSize(0.0f);
|
||||
window->SkipItems = backup_skip_items;
|
||||
ImGui::NavUpdateCurrentWindowIsScrollPushableX();
|
||||
}
|
||||
}
|
||||
@ -7132,8 +7135,12 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
|
||||
|
||||
// Close button
|
||||
if (has_close_button)
|
||||
{
|
||||
g.CurrentItemFlags |= ImGuiItemFlags_NoFocus;
|
||||
if (CloseButton(window->GetID("#CLOSE"), close_button_pos))
|
||||
*p_open = false;
|
||||
g.CurrentItemFlags &= ~ImGuiItemFlags_NoFocus;
|
||||
}
|
||||
|
||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
||||
g.CurrentItemFlags = item_flags_backup;
|
||||
@ -8710,6 +8717,21 @@ bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max)
|
||||
// Most of the relevant font logic is in imgui_draw.cpp.
|
||||
// Those are high-level support functions.
|
||||
//-----------------------------------------------------------------------------
|
||||
// - UpdateFontsNewFrame() [Internal]
|
||||
// - UpdateFontsEndFrame() [Internal]
|
||||
// - GetDefaultFont() [Internal]
|
||||
// - RegisterUserTexture() [Internal]
|
||||
// - UnregisterUserTexture() [Internal]
|
||||
// - RegisterFontAtlas() [Internal]
|
||||
// - UnregisterFontAtlas() [Internal]
|
||||
// - SetCurrentFont() [Internal]
|
||||
// - UpdateCurrentFontSize() [Internal]
|
||||
// - SetFontRasterizerDensity() [Internal]
|
||||
// - PushFont()
|
||||
// - PopFont()
|
||||
// - PushFontSize()
|
||||
// - PopFontSize()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ImGui::UpdateFontsNewFrame()
|
||||
{
|
||||
@ -8824,12 +8846,10 @@ void ImGui::UpdateCurrentFontSize(float restore_font_size_after_scaling)
|
||||
|
||||
// Early out to avoid hidden window keeping bakes referenced and out of GC reach.
|
||||
// However this would leave a pretty subtle and damning error surface area if g.FontBaked was mismatching, so for now we null it.
|
||||
// FIXME: perhaps g.FontSize should be updated?
|
||||
if (window != NULL && window->SkipItems)
|
||||
if (g.CurrentTable == NULL || g.CurrentTable->CurrentColumn != -1) // See 8465#issuecomment-2951509561. Ideally the SkipItems=true in tables would be amended with extra data.
|
||||
{
|
||||
g.FontBaked = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
// Restoring is pretty much only used by PopFont()/PopFontSize()
|
||||
float final_size = (restore_font_size_after_scaling > 0.0f) ? restore_font_size_after_scaling : 0.0f;
|
||||
|
@ -548,6 +548,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
ImGuiItemFlags item_flags = (g.LastItemData.ID == id ? g.LastItemData.ItemFlags : g.CurrentItemFlags);
|
||||
if (flags & ImGuiButtonFlags_AllowOverlap)
|
||||
item_flags |= ImGuiItemFlags_AllowOverlap;
|
||||
if (item_flags & ImGuiItemFlags_NoFocus)
|
||||
flags |= ImGuiButtonFlags_NoFocus | ImGuiButtonFlags_NoNavFocus;
|
||||
|
||||
// Default only reacts to left mouse button
|
||||
if ((flags & ImGuiButtonFlags_MouseButtonMask_) == 0)
|
||||
@ -623,7 +625,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
SetFocusID(id, window);
|
||||
FocusWindow(window);
|
||||
}
|
||||
else
|
||||
else if (!(flags & ImGuiButtonFlags_NoFocus))
|
||||
{
|
||||
FocusWindow(window, ImGuiFocusRequestFlags_RestoreFocusedChild); // Still need to focus and bring to front, but try to avoid losing NavId when navigating a child
|
||||
}
|
||||
@ -641,7 +643,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
SetFocusID(id, window);
|
||||
FocusWindow(window);
|
||||
}
|
||||
else
|
||||
else if (!(flags & ImGuiButtonFlags_NoFocus))
|
||||
{
|
||||
FocusWindow(window, ImGuiFocusRequestFlags_RestoreFocusedChild); // Still need to focus and bring to front, but try to avoid losing NavId when navigating a child
|
||||
}
|
||||
|
@ -4516,8 +4516,8 @@ static int stbtt__compute_crossings_x(float x, float y, int nverts, stbtt_vertex
|
||||
q2[0] = (float)x2;
|
||||
q2[1] = (float)y2;
|
||||
if (equal(q0,q1) || equal(q1,q2)) {
|
||||
x0 = (int)verts[i-1].x;
|
||||
y0 = (int)verts[i-1].y;
|
||||
x0 = (int)verts[i-1].x; //-V1048
|
||||
y0 = (int)verts[i-1].y; //-V1048
|
||||
x1 = (int)verts[i ].x;
|
||||
y1 = (int)verts[i ].y;
|
||||
if (y > STBTT_min(y0,y1) && y < STBTT_max(y0,y1) && x > STBTT_min(x0,x1)) {
|
||||
|
@ -420,7 +420,8 @@ void ImGuiManager::DrawPerformanceOverlay(const GPUBackend* gpu, float& position
|
||||
float spacing)
|
||||
{
|
||||
if (!(g_gpu_settings.display_show_fps || g_gpu_settings.display_show_speed || g_gpu_settings.display_show_gpu_stats ||
|
||||
g_gpu_settings.display_show_resolution || g_gpu_settings.display_show_cpu_usage ||
|
||||
g_gpu_settings.display_show_resolution || g_gpu_settings.display_show_latency_stats ||
|
||||
g_gpu_settings.display_show_cpu_usage || g_gpu_settings.display_show_gpu_usage ||
|
||||
g_gpu_settings.display_show_frame_times ||
|
||||
(g_gpu_settings.display_show_status_indicators &&
|
||||
(GPUThread::IsSystemPaused() || System::IsFastForwardEnabled() || System::IsTurboEnabled()))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user