From d8b6fbfef0a1af64345b68a55bc35573addc366c Mon Sep 17 00:00:00 2001
From: James Turner <zakalawe@mac.com>
Date: Mon, 27 May 2019 16:05:19 +0100
Subject: [PATCH] macOS / DBus : avoid abort on startup
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Don’t do the fgOSDisableScreensave DBus stuff on macOS - there is no
global DBus daemon configured by default.
---
 src/Main/screensaver_control.cxx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Main/screensaver_control.cxx b/src/Main/screensaver_control.cxx
index 0af20eb42..f6a33fee4 100644
--- a/src/Main/screensaver_control.cxx
+++ b/src/Main/screensaver_control.cxx
@@ -20,9 +20,9 @@
 //
 // $Id$
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
+#include <simgear/compiler.h>
+
 #ifdef HAVE_DBUS
 #include <dbus/dbus.h>//Uses the low-level libdbus rather than GDBus/QtDBus to avoid adding more dependencies than necessary.  http://dbus.freedesktop.org/doc/api/html/index.html
 #endif
@@ -38,7 +38,7 @@
 */
 void fgOSDisableScreensaver()
 {
-#ifdef HAVE_DBUS
+#if defined(HAVE_DBUS) && defined(SG_UNIX) && !defined(SG_MAC)
     DBusConnection *dbus_connection;
     DBusMessage *dbus_inhibit_screenlock;
     unsigned int window_id=1000;//fake-it doesn't seem to care