Various OSX warnings fixes.
[dcpomatic.git] / src / lib / cross_osx.cc
index 574cc8660887b059185dc5d120fa18fb6d114af7..aa05df01688b4ab9c49314a661d5e26feec8fa2a 100644 (file)
@@ -24,6 +24,7 @@
 #include "dcpomatic_log.h"
 #include "config.h"
 #include "exceptions.h"
+#include "warnings.h"
 #include <dcp/raw_convert.h>
 #include <glib.h>
 extern "C" {
@@ -35,6 +36,7 @@ extern "C" {
 #if BOOST_VERSION >= 106100
 #include <boost/dll/runtime_symbol_info.hpp>
 #endif
+#include <ApplicationServices/ApplicationServices.h>
 #include <sys/sysctl.h>
 #include <mach-o/dyld.h>
 #include <IOKit/pwr_mgt/IOPMLib.h>
@@ -180,10 +182,7 @@ Waker::nudge ()
 Waker::Waker ()
 {
        boost::mutex::scoped_lock lm (_mutex);
-       /* We should use this */
-        // IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id);
-       /* but it's not available on 10.5, so we use this */
-        IOPMAssertionCreate (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &_assertion_id);
+       IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id);
 }
 
 Waker::~Waker ()
@@ -566,3 +565,14 @@ disk_write_finished ()
 
 }
 
+
+void
+make_foreground_application ()
+{
+       ProcessSerialNumber serial;
+DCPOMATIC_DISABLE_WARNINGS
+       GetCurrentProcess (&serial);
+DCPOMATIC_ENABLE_WARNINGS
+       TransformProcessType (&serial, kProcessTransformToForegroundApplication);
+}
+