diff --git a/bam.lua b/bam.lua
index 1022aded7..8457b7529 100644
--- a/bam.lua
+++ b/bam.lua
@@ -283,6 +283,7 @@ function build(settings)
client_settings.link.frameworks:Add("Carbon")
client_settings.link.frameworks:Add("Cocoa")
launcher_settings.link.frameworks:Add("Cocoa")
+ client_settings.cc.flags:Add("-I/opt/X11/include")
else
client_settings.link.libs:Add("X11")
client_settings.link.libs:Add("GL")
@@ -329,9 +330,14 @@ function build(settings)
-- build tools (TODO: fix this so we don't get double _d_d stuff)
tools_src = Collect("src/tools/*.cpp", "src/tools/*.c")
+ client_notification = {}
client_osxlaunch = {}
server_osxlaunch = {}
if platform == "macosx" then
+ notification_settings = client_settings:Copy()
+ notification_settings.cc.flags:Add("-x objective-c++")
+ notification_settings.cc.flags:Add("-I/System/Library/Frameworks/Foundation.framework/Versions/C/Headers")
+ client_notification = Compile(notification_settings, "src/osx/notification.m")
client_osxlaunch = Compile(client_settings, "src/osxlaunch/client.m")
server_osxlaunch = Compile(launcher_settings, "src/osxlaunch/server.m")
end
@@ -345,7 +351,7 @@ function build(settings)
-- build client, server, version server and master server
client_exe = Link(client_settings, "DDNet", game_shared, game_client,
engine, client, game_editor, zlib, pnglite, wavpack,
- client_link_other, client_osxlaunch, jsonparser, libwebsockets, md5)
+ client_link_other, client_osxlaunch, jsonparser, libwebsockets, md5, client_notification)
server_exe = Link(server_settings, "DDNet-Server", engine, server,
game_shared, game_server, zlib, server_link_other, libwebsockets, md5)
diff --git a/scripts/make_release.py b/scripts/make_release.py
index c933c647d..b4c6d7b39 100644
--- a/scripts/make_release.py
+++ b/scripts/make_release.py
@@ -152,6 +152,8 @@ if use_bundle:
????
CFBundleVersion
%s
+ CFBundleIdentifier
+ org.DDNetClient.app
""" % (version))
diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp
index aca557ec0..f2c423ff7 100644
--- a/src/game/client/components/chat.cpp
+++ b/src/game/client/components/chat.cpp
@@ -18,6 +18,10 @@
#include
#include
+#ifdef CONF_PLATFORM_MACOSX
+#include
+#endif
+
#include "chat.h"
@@ -469,7 +473,13 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
{
if(Now-m_aLastSoundPlayed[CHAT_HIGHLIGHT] >= time_freq()*3/10)
{
+#ifdef CONF_PLATFORM_MACOSX
+ char aBuf[1024];
+ str_format(aBuf, sizeof(aBuf), "%s%s", m_aLines[m_CurrentLine].m_aName, m_aLines[m_CurrentLine].m_aText);
+ CNotification::notify("DDNet-Chat", aBuf);
+#else
Graphics()->NotifyWindow();
+#endif
if(g_Config.m_SndHighlight)
{
m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_HIGHLIGHT, 0);
diff --git a/src/osx/notification.h b/src/osx/notification.h
new file mode 100644
index 000000000..ce32f9bcc
--- /dev/null
+++ b/src/osx/notification.h
@@ -0,0 +1,10 @@
+#ifndef NOTIFICATION_H
+#define NOTIFICATION_H
+
+class CNotification
+{
+ public:
+ static void notify(const char *pTitle, const char *pMsg);
+};
+
+#endif // NOTIFICATION_H
diff --git a/src/osx/notification.m b/src/osx/notification.m
new file mode 100644
index 000000000..5a808e96a
--- /dev/null
+++ b/src/osx/notification.m
@@ -0,0 +1,19 @@
+#include
+#include
+#include
+#include "notification.h"
+
+void CNotification::notify(const char *pTitle, const char *pMsg)
+{
+ NSString* title = [NSString stringWithCString:pTitle encoding:NSUTF8StringEncoding];
+ NSString* msg = [NSString stringWithCString:pMsg encoding:NSUTF8StringEncoding];
+
+ NSUserNotification *notification = [[NSUserNotification alloc] autorelease];
+ notification.title = title;
+ notification.informativeText = msg;
+ notification.soundName = NSUserNotificationDefaultSoundName;
+
+ [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
+
+ [NSApp requestUserAttention:NSInformationalRequest]; // use NSCriticalRequest to annoy the user (doesn't stop bouncing)
+}