fixed a mismatching push/pop pair in the overlay style

This commit is contained in:
otavepto 2024-04-25 12:32:53 +02:00
parent a0885417c6
commit 931959afb6

View File

@ -801,11 +801,11 @@ void Steam_Overlay::build_friend_window(Friend const& frd, friend_window_state&
ImGui::PushID((const char *)&frd_id, (const char *)&frd_id + sizeof(frd_id));
ImGui::PushItemWidth(wnd_width);
if (ImGui::InputText("##chat_line", state.chat_input, max_chat_len, ImGuiInputTextFlags_EnterReturnsTrue))
{
if (ImGui::InputText("##chat_line", state.chat_input, max_chat_len, ImGuiInputTextFlags_EnterReturnsTrue)) {
send_chat_msg = true;
ImGui::SetKeyboardFocusHere(-1);
}
ImGui::PopItemWidth();
ImGui::PopID();
@ -927,6 +927,7 @@ void Steam_Overlay::build_notifications(int width, int height)
float font_size = ImGui::GetFontSize();
std::queue<Friend> friend_actions_temp{};
ImGui::PushFont(font_notif);
// Add window rounding
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, settings->overlay_appearance.notification_rounding);
@ -1027,6 +1028,7 @@ void Steam_Overlay::build_notifications(int width, int height)
}
ImGui::PopStyleVar();
ImGui::PopFont();
// erase all notifications whose visible time exceeded the max
notifications.erase(std::remove_if(notifications.begin(), notifications.end(), [this, &now](Notification &item) {
@ -1179,9 +1181,7 @@ void Steam_Overlay::overlay_render_proc()
}
if (notifications.size()) {
ImGui::PushFont(font_notif);
build_notifications(io.DisplaySize.x, io.DisplaySize.y);
ImGui::PopFont();
}
}
@ -1200,6 +1200,7 @@ void Steam_Overlay::render_main_window()
// think of it as translating "Protobuf - Google"
windowTitle.append("Ingame Overlay project - Nemirtingas (").append(tmp).append(")");
int style_color_stack = 0;
if ((settings->overlay_appearance.background_r >= 0) &&
(settings->overlay_appearance.background_g >= 0) &&
(settings->overlay_appearance.background_b >= 0) &&
@ -1211,6 +1212,7 @@ void Steam_Overlay::render_main_window()
settings->overlay_appearance.background_a
);
ImGui::PushStyleColor(ImGuiCol_WindowBg, colorSet);
style_color_stack += 1;
}
if ((settings->overlay_appearance.element_r >= 0) &&
@ -1227,6 +1229,7 @@ void Steam_Overlay::render_main_window()
ImGui::PushStyleColor(ImGuiCol_Button, colorSet);
ImGui::PushStyleColor(ImGuiCol_FrameBg, colorSet);
ImGui::PushStyleColor(ImGuiCol_ResizeGrip, colorSet);
style_color_stack += 4;
}
if ((settings->overlay_appearance.element_hovered_r >= 0) &&
@ -1243,6 +1246,7 @@ void Steam_Overlay::render_main_window()
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, colorSet);
ImGui::PushStyleColor(ImGuiCol_ResizeGripHovered, colorSet);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, colorSet);
style_color_stack += 4;
}
if ((settings->overlay_appearance.element_active_r >= 0) &&
@ -1260,6 +1264,7 @@ void Steam_Overlay::render_main_window()
ImGui::PushStyleColor(ImGuiCol_ResizeGripActive, colorSet);
ImGui::PushStyleColor(ImGuiCol_Header, colorSet);
ImGui::PushStyleColor(ImGuiCol_HeaderActive, colorSet);
style_color_stack += 5;
}
if (ImGui::Begin(windowTitle.c_str(), &show,
@ -1499,6 +1504,7 @@ void Steam_Overlay::render_main_window()
ImGui::End();
if (style_color_stack) ImGui::PopStyleColor(style_color_stack);
ImGui::PopFont();
if (!show) ShowOverlay(false);