From 5069483bf5f0fc22d9daf3a8a59d2e73251330cf Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 5 Jan 2014 11:47:18 +0100 Subject: [PATCH] Use __APPLE__ compile switch for OS X It seems that on Apple machines the compiler will always define the symbol __APPLE__, so this is now used instead of OSX, which had to be defined with a -DOSX compiler flag. The gtkmacintegration header is now using <> in stead of "" in its #include. (Strange enough both were working.) --- gtk/xboard.c | 10 +++++----- gtk/xoptions.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gtk/xboard.c b/gtk/xboard.c index 16d7a9f..fa13d74 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -167,8 +167,8 @@ extern char *getenv(); #include "gettext.h" #include "draw.h" -#ifdef OSX -# include "gtkmacintegration/gtkosxapplication.h" +#ifdef __APPLE__ +# include // prevent pathname of positional file argument provided by OS X being be mistaken for option name // (price is that we won't recognize Windows option format anymore). # define SLASH '-' @@ -728,7 +728,7 @@ SlaveResize (Option *opt) gtk_window_resize(GTK_WINDOW(shells[DummyDlg]), slaveW + opt->max, slaveH + opt->value); } -#ifdef OSX +#ifdef __APPLE__ static char clickedFile[MSG_SIZ]; static int suppress; @@ -772,7 +772,7 @@ main (int argc, char **argv) /* set up GTK */ gtk_init (&argc, &argv); -#ifdef OSX +#ifdef __APPLE__ { // prepare to catch OX OpenFile signal, which will tell us the clicked file GtkosxApplication *theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL); dataDir = gtkosx_application_get_bundle_path(); @@ -1785,7 +1785,7 @@ TempForwardProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) void ManProc () { // called from menu -#ifdef OSX +#ifdef __APPLE__ system("%s ./man.command", appData.sysOpen); #else system("xterm -e man xboard &"); diff --git a/gtk/xoptions.c b/gtk/xoptions.c index 0eb64ff..c56ba90 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -51,8 +51,8 @@ extern char *getenv(); #include #include #include -#ifdef OSX -# include "gtkmacintegration/gtkosxapplication.h" +#ifdef __APPLE__ +# include #endif #include "common.h" @@ -428,7 +428,7 @@ CreateMenuPopup (Option *opt, int n, int def) { char *msg = mb[i].string; if(!msg) break; -#ifdef OSX +#ifdef __APPLE__ if(!strcmp(msg, "Quit ")) continue; // Quit item will appear automatically in App menu if(!strcmp(msg, "About XBoard")) msg = "About"; // 'XBoard' will be appended automatically when moved to App menu 1st item #endif @@ -445,7 +445,7 @@ CreateMenuPopup (Option *opt, int n, int def) GdkModifierType accelerator_mods; gtk_accelerator_parse(mb[i].accel, &accelerator_key, &accelerator_mods); -#ifdef OSX +#ifdef __APPLE__ if(accelerator_mods & GDK_CONTROL_MASK) { // in OSX use Meta where Linux uses Ctrl accelerator_mods &= ~GDK_CONTROL_MASK; // clear Ctrl flag accelerator_mods |= GDK_META_MASK; // set Meta flag @@ -1493,7 +1493,7 @@ if(appData.debugMode) printf("n=%d, h=%d, w=%d\n",n,height,width); break; case BarEnd: top--; -#ifndef OSX +#ifndef __APPLE__ gtk_table_attach(GTK_TABLE(table), menuBar, left, left+r, top, top+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 2, 1); if(option[i].target) ((ButtonCallback*)option[i].target)(boxStart); // callback that can make sizing decisions -- 1.7.0.4