commit 891db76d6384c42e61bda4432339a7238d240ba6
parent 144d1fa2cf2c83d491d1c3774a3e9c3941193253
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date: Thu, 16 Aug 2012 09:35:18 -0700
osx: Make it a foreground application
Diffstat:
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/spek-platform.cc b/src/spek-platform.cc
@@ -18,12 +18,25 @@
#include <cstring>
+#ifdef OS_OSX
+#include <ApplicationServices/ApplicationServices.h>
+#endif
+
#include <wx/filename.h>
#include <wx/stdpaths.h>
#include <wx/utils.h>
#include "spek-platform.hh"
+void SpekPlatform::init()
+{
+#ifdef OS_OSX
+ ProcessSerialNumber PSN;
+ GetCurrentProcess(&PSN);
+ TransformProcessType(&PSN, kProcessTransformToForegroundApplication);
+#endif
+}
+
wxString SpekPlatform::config_path(const wxString& app_name)
{
#ifdef OS_WIN
diff --git a/src/spek-platform.hh b/src/spek-platform.hh
@@ -25,6 +25,9 @@
class SpekPlatform
{
public:
+ // Platform-specific initialisation code.
+ void init();
+
// Not quite XDG-compatible, but close enough.
static wxString config_path(const wxString& app_name);