Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/core/Frontend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class Frontend

// Queries
virtual bool IsWindowMinimized() = 0;
virtual bool IsWindowFocused() = 0;

// Strings
virtual std::string GetDirectMessagesText() = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/core/state/NotificationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ bool NotificationManager::IsNotificationWorthy(Snowflake guildID, Snowflake chan
}
}

// If we are focused on this very channel and the window is not minimized, return
if (channelID == m_pDiscord->GetCurrentChannelID() && !GetFrontend()->IsWindowMinimized())
// If we are focused on this very channel and the window is in focus, return
if (channelID == m_pDiscord->GetCurrentChannelID() && GetFrontend()->IsWindowFocused())
return false;

auto pSettings = m_pDiscord->m_userGuildSettings.GetSettings(guildID);
Expand Down
5 changes: 5 additions & 0 deletions src/windows/Frontend_Win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,11 @@ bool Frontend_Win32::IsWindowMinimized()
return IsIconic(g_Hwnd);
}

bool Frontend_Win32::IsWindowFocused()
{
return GetForegroundWindow() == g_Hwnd;
}

#ifdef USE_DEBUG_PRINTS

void DbgPrintWV(const char* fmt, va_list vl)
Expand Down
1 change: 1 addition & 0 deletions src/windows/Frontend_Win32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Frontend_Win32 : public Frontend
void RestoreWindow() override;
void MaximizeWindow() override;
bool IsWindowMinimized() override;
bool IsWindowFocused() override;
std::string GetDirectMessagesText() override;
std::string GetPleaseWaitText() override;
std::string GetMonthName(int index) override;
Expand Down