]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Introduce a config option for building on OS X GTK.
authorSimon Tatham <anakin@pobox.com>
Mon, 31 Aug 2015 12:05:51 +0000 (13:05 +0100)
committerSimon Tatham <anakin@pobox.com>
Mon, 31 Aug 2015 12:21:50 +0000 (13:21 +0100)
Using GTK to run on OS X is going to require several workarounds and
behaviour tweaks to be enabled at various points in the code, and it's
already getting cumbersome to remember what they all are to put on the
command line. Here's a central #define (OSX_GTK) that enables them all
in one go, and a configure option (--with-quartz) that sets it.

As part of this commit, I've also rearranged the #include order in the
GTK source files, so that they include unix.h (which now might be
where NOT_X_WINDOWS gets defined) before they test NOT_X_WINDOWS to
decide whether to include X11 headers.

configure.ac
unix/gtkdlg.c
unix/gtkfont.c
unix/gtkwin.c
unix/unix.h

index f1bff9552851907993dac19c9572e4b146cece33..2ad3675b144851de4a331a098dd38b58c62b2a11 100644 (file)
@@ -48,6 +48,12 @@ AC_ARG_WITH([gssapi],
   [],
   [with_gssapi=yes])
 
+AC_ARG_WITH([quartz],
+  [AS_HELP_STRING([--with-quartz],
+                  [build for the MacOS Quartz GTK back end])],
+  [AC_DEFINE([OSX_GTK], [1], [Define if building with GTK for MacOS.])],
+  [])
+
 WITH_GSSAPI=
 AS_IF([test "x$with_gssapi" != xno],
   [AC_DEFINE([WITH_GSSAPI], [1], [Define if building with GSSAPI support.])])
index c044c0623347d1435e641edcb45a28b358501514..23e9f465c8ae58f59275e31966d33933763978a8 100644 (file)
@@ -6,26 +6,27 @@
 #include <stdarg.h>
 #include <ctype.h>
 #include <time.h>
+
 #include <gtk/gtk.h>
 #if !GTK_CHECK_VERSION(3,0,0)
 #include <gdk/gdkkeysyms.h>
 #endif
+
+#include "putty.h"
+#include "gtkcompat.h"
+#include "gtkcols.h"
+#include "gtkfont.h"
+
 #ifndef NOT_X_WINDOWS
 #include <gdk/gdkx.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #endif
 
-#include "gtkcompat.h"
-
-#include "gtkcols.h"
-#include "gtkfont.h"
-
 #ifdef TESTMODE
 #define PUTTY_DO_GLOBALS              /* actually _define_ globals */
 #endif
 
-#include "putty.h"
 #include "storage.h"
 #include "dialog.h"
 #include "tree234.h"
index a43363b982273a54b92c16ba0ba7067e89e3dc8a..1a9860ab0eee5c14216365d7c7daed9d9055fcac 100644 (file)
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
+
 #include <gtk/gtk.h>
 #if !GTK_CHECK_VERSION(3,0,0)
 #include <gdk/gdkkeysyms.h>
 #endif
+
+#include "putty.h"
+#include "gtkfont.h"
+#include "gtkcompat.h"
+#include "tree234.h"
+
 #ifndef NOT_X_WINDOWS
 #include <gdk/gdkx.h>
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 #endif
 
-#include "putty.h"
-#include "gtkfont.h"
-#include "gtkcompat.h"
-#include "tree234.h"
-
 /*
  * Future work:
  * 
index f6befeed8462e1bd60127642f722e8662c11fc4c..69535c36308da3f1a0324ebcf1868d0cd2f3897d 100644 (file)
 #if !GTK_CHECK_VERSION(3,0,0)
 #include <gdk/gdkkeysyms.h>
 #endif
-#ifndef NOT_X_WINDOWS
-#include <gdk/gdkx.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
-#endif
 
 #if GTK_CHECK_VERSION(2,0,0)
 #include <gtk/gtkimmodule.h>
 #include "gtkcompat.h"
 #include "gtkfont.h"
 
+#ifndef NOT_X_WINDOWS
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+#endif
+
 #define CAT2(x,y) x ## y
 #define CAT(x,y) CAT2(x,y)
 #define ASSERT(x) enum {CAT(assertion_,__LINE__) = 1 / (x)}
index fbe025ba656959363c5e55b7c5d02c4d39a49965..90922451797a9f41491cdee5be1282c8177a10fd 100644 (file)
 #endif /*  NO_LIBDL */
 #include "charset.h"
 
+#ifdef OSX_GTK
+/*
+ * Assorted tweaks to various parts of the GTK front end which all
+ * need to be enabled when compiling on OS X. Because I might need the
+ * same tweaks on other systems in future, I don't want to
+ * conditionalise all of them on OSX_GTK directly, so instead, each
+ * one has its own name and we enable them all centrally here if
+ * OSX_GTK is defined at configure time.
+ */
+#define NOT_X_WINDOWS /* of course, all the X11 stuff should be disabled */
+#define NO_PTY_PRE_INIT /* OS X gets very huffy if we try to set[ug]id */
+#define SET_NONBLOCK_VIA_OPENPT /* work around missing fcntl functionality */
+#endif
+
 struct Filename {
     char *path;
 };