When taking a screenshot, clear all notifications except achievements.

This commit is contained in:
Henrik Rydgård committed 2026-10-11 17:40:01 +02:00
1 parent 9741bcacd9
commit e46bd61e2e
3 files changed
+19 -2

No files matched your search

+13
View File
@@ -345,3 +345,16 @@ void OnScreenDisplay::SetFlags(std::string_view id, OSDMessageFlags flags) {
}
}
}
void OnScreenDisplay::ClearNonAchievementEntries() {
std::lock_guard<std::mutex> guard(mutex_);
for (auto iter = entries_.begin(); iter != entries_.end();) {
if (iter->type != OSDType::ACHIEVEMENT_UNLOCKED &&
iter->type != OSDType::ACHIEVEMENT_PROGRESS &&
iter->type != OSDType::ACHIEVEMENT_CHALLENGE_INDICATOR) {
iter = entries_.erase(iter);
} else {
iter++;
}
}
}
+2
View File
@@ -121,6 +121,8 @@ public:
static float FadeinTime() { return 0.1f; }
static float FadeoutTime() { return 0.25f; }
void ClearNonAchievementEntries();
private:
std::vector<Entry> entries_;
std::mutex mutex_;
+4 -2
View File
@@ -524,8 +524,10 @@ void TakeUserScreenshot() {
type = ScreenshotType::Output;
}
// Close any earlier screenshot popups, so they don't end up in the next one.
g_OSD.CancelById("screenshot_link");
// Close any active popups, so they don't end up in the screenshot.
// However people often want to take screenshots of achievement things,
// so keep those.
g_OSD.ClearNonAchievementEntries();
ScheduleScreenshot(filename, g_Config.bScreenshotsAsPNG ? ScreenshotFormat::PNG : ScreenshotFormat::JPG, type, -1, [filename](ScreenshotResult result) {
if (result == ScreenshotResult::Success) {