fix default notification height + a potential crash when creating notification table during exit

This commit is contained in:
otavepto 2024-03-06 00:59:44 +02:00 committed by otavepto
parent 99d689118e
commit d3c4026447
2 changed files with 3 additions and 4 deletions

View File

@ -54,7 +54,7 @@ enum notification_type
struct Notification
{
static constexpr float width_percent = 0.25f; // percentage from total width
static constexpr float height = 5.0f;
static constexpr float height = 6.5f;
static constexpr std::chrono::milliseconds fade_in = std::chrono::milliseconds(2000);
static constexpr std::chrono::milliseconds fade_out = std::chrono::milliseconds(2000);
static constexpr std::chrono::milliseconds show_time = std::chrono::milliseconds(6000) + fade_in + fade_out;

View File

@ -931,14 +931,13 @@ void Steam_Overlay::BuildNotifications(int width, int height)
switch (it->type) {
case notification_type_achievement: {
if (!it->icon.expired()) {
ImGui::BeginTable("imgui_table", 2);
if (!it->icon.expired() && ImGui::BeginTable("imgui_table", 2)) {
ImGui::TableSetupColumn("imgui_table_image", ImGuiTableColumnFlags_WidthFixed, settings->overlay_appearance.icon_size);
ImGui::TableSetupColumn("imgui_table_text");
ImGui::TableNextRow(ImGuiTableRowFlags_None, settings->overlay_appearance.icon_size);
ImGui::TableSetColumnIndex(0);
ImGui::Image((ImU64)*it->icon.lock().get(), ImVec2(settings->overlay_appearance.icon_size, settings->overlay_appearance.icon_size));
ImGui::Image((ImTextureID)*it->icon.lock().get(), ImVec2(settings->overlay_appearance.icon_size, settings->overlay_appearance.icon_size));
ImGui::TableSetColumnIndex(1);
ImGui::TextWrapped("%s", it->message.c_str());