mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-08 12:35:48 +00:00
FullscreenUI: Run idle while notifications/toasts are onscreen
This commit is contained in:
parent
730fa67952
commit
37230107f4
@ -766,7 +766,8 @@ bool FullscreenUI::AreAnyDialogsOpen()
|
|||||||
return (s_state.save_state_selector_open || s_state.input_binding_type != InputBindingInfo::Type::Unknown ||
|
return (s_state.save_state_selector_open || s_state.input_binding_type != InputBindingInfo::Type::Unknown ||
|
||||||
ImGuiFullscreen::IsAnyFixedPopupDialogOpen() || ImGuiFullscreen::IsChoiceDialogOpen() ||
|
ImGuiFullscreen::IsAnyFixedPopupDialogOpen() || ImGuiFullscreen::IsChoiceDialogOpen() ||
|
||||||
ImGuiFullscreen::IsInputDialogOpen() || ImGuiFullscreen::IsFileSelectorOpen() ||
|
ImGuiFullscreen::IsInputDialogOpen() || ImGuiFullscreen::IsFileSelectorOpen() ||
|
||||||
ImGuiFullscreen::IsMessageBoxDialogOpen());
|
ImGuiFullscreen::IsMessageBoxDialogOpen() || ImGuiFullscreen::HasToast() ||
|
||||||
|
ImGuiFullscreen::HasAnyNotifications());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullscreenUI::CheckForConfigChanges(const GPUSettings& old_settings)
|
void FullscreenUI::CheckForConfigChanges(const GPUSettings& old_settings)
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "core/host.h"
|
#include "core/host.h"
|
||||||
#include "core/system.h" // For async workers, should be in general host.
|
#include "core/system.h" // For async workers, should be in general host.
|
||||||
|
#include "core/fullscreen_ui.h" // For updating run idle state.
|
||||||
|
|
||||||
#include "fmt/core.h"
|
#include "fmt/core.h"
|
||||||
|
|
||||||
@ -3445,6 +3446,12 @@ void ImGuiFullscreen::AddNotification(std::string key, float duration, std::stri
|
|||||||
notif.target_y = -1.0f;
|
notif.target_y = -1.0f;
|
||||||
notif.last_y = -1.0f;
|
notif.last_y = -1.0f;
|
||||||
s_state.notifications.push_back(std::move(notif));
|
s_state.notifications.push_back(std::move(notif));
|
||||||
|
FullscreenUI::UpdateRunIdleState();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGuiFullscreen::HasAnyNotifications()
|
||||||
|
{
|
||||||
|
return !s_state.notifications.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiFullscreen::ClearNotifications()
|
void ImGuiFullscreen::ClearNotifications()
|
||||||
@ -3585,6 +3592,10 @@ void ImGuiFullscreen::DrawNotifications(ImVec2& position, float spacing)
|
|||||||
position.y += s_notification_vertical_direction * (box_height + shadow_size + spacing);
|
position.y += s_notification_vertical_direction * (box_height + shadow_size + spacing);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// all gone?
|
||||||
|
if (s_state.notifications.empty())
|
||||||
|
FullscreenUI::UpdateRunIdleState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiFullscreen::ShowToast(std::string title, std::string message, float duration)
|
void ImGuiFullscreen::ShowToast(std::string title, std::string message, float duration)
|
||||||
@ -3593,6 +3604,12 @@ void ImGuiFullscreen::ShowToast(std::string title, std::string message, float du
|
|||||||
s_state.toast_message = std::move(message);
|
s_state.toast_message = std::move(message);
|
||||||
s_state.toast_start_time = Timer::GetCurrentValue();
|
s_state.toast_start_time = Timer::GetCurrentValue();
|
||||||
s_state.toast_duration = duration;
|
s_state.toast_duration = duration;
|
||||||
|
FullscreenUI::UpdateRunIdleState();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGuiFullscreen::HasToast()
|
||||||
|
{
|
||||||
|
return (!s_state.toast_title.empty() || !s_state.toast_message.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiFullscreen::ClearToast()
|
void ImGuiFullscreen::ClearToast()
|
||||||
@ -3601,6 +3618,7 @@ void ImGuiFullscreen::ClearToast()
|
|||||||
s_state.toast_title = {};
|
s_state.toast_title = {};
|
||||||
s_state.toast_start_time = 0;
|
s_state.toast_start_time = 0;
|
||||||
s_state.toast_duration = 0.0f;
|
s_state.toast_duration = 0.0f;
|
||||||
|
FullscreenUI::UpdateRunIdleState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiFullscreen::DrawToast()
|
void ImGuiFullscreen::DrawToast()
|
||||||
|
@ -407,9 +407,11 @@ void CloseLoadingScreen();
|
|||||||
void RenderLoadingScreen();
|
void RenderLoadingScreen();
|
||||||
|
|
||||||
void AddNotification(std::string key, float duration, std::string title, std::string text, std::string image_path);
|
void AddNotification(std::string key, float duration, std::string title, std::string text, std::string image_path);
|
||||||
|
bool HasAnyNotifications();
|
||||||
void ClearNotifications();
|
void ClearNotifications();
|
||||||
|
|
||||||
void ShowToast(std::string title, std::string message, float duration = 10.0f);
|
void ShowToast(std::string title, std::string message, float duration = 10.0f);
|
||||||
|
bool HasToast();
|
||||||
void ClearToast();
|
void ClearToast();
|
||||||
|
|
||||||
// Message callbacks.
|
// Message callbacks.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user