r8854/5 broke compilation with Gtk 1.2. Grow a hack to cope.
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Sun, 14 Mar 2010 18:58:20 +0000 (18:58 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Sun, 14 Mar 2010 18:58:20 +0000 (18:58 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@8901 cda61777-01e9-0310-a592-d414129be87e

unix/gtkwin.c

index 93e96da..d08dffd 100644 (file)
 #define CAT(x,y) CAT2(x,y)
 #define ASSERT(x) enum {CAT(assertion_,__LINE__) = 1 / (x)}
 
+#if GTK_CHECK_VERSION(2,0,0)
+ASSERT(sizeof(long) <= sizeof(gsize));
+#define LONG_TO_GPOINTER(l) GSIZE_TO_POINTER(l)
+#define GPOINTER_TO_LONG(p) GPOINTER_TO_SIZE(p)
+#else /* Gtk 1.2 */
+ASSERT(sizeof(long) <= sizeof(gpointer));
+#define LONG_TO_GPOINTER(l) ((gpointer)(long)(l))
+#define GPOINTER_TO_LONG(p) ((long)(p))
+#endif
+
 /* Colours come in two flavours: configurable, and xterm-extended. */
 #define NCFGCOLOURS (lenof(((Config *)0)->colours))
 #define NEXTCOLOURS 240 /* 216 colour-cube plus 24 shades of grey */
@@ -1280,14 +1290,14 @@ void notify_remote_exit(void *frontend)
 
 static gint timer_trigger(gpointer data)
 {
-    long now = GPOINTER_TO_SIZE(data);
+    long now = GPOINTER_TO_LONG(data);
     long next;
     long ticks;
 
     if (run_timers(now, &next)) {
        ticks = next - GETTICKCOUNT();
        timer_id = gtk_timeout_add(ticks > 0 ? ticks : 1, timer_trigger,
-                                  GSIZE_TO_POINTER(next));
+                                  LONG_TO_GPOINTER(next));
     }
 
     /*
@@ -1309,7 +1319,7 @@ void timer_change_notify(long next)
        ticks = 1;                     /* just in case */
 
     timer_id = gtk_timeout_add(ticks, timer_trigger,
-                              GSIZE_TO_POINTER(next));
+                              LONG_TO_GPOINTER(next));
 }
 
 void fd_input_func(gpointer data, gint sourcefd, GdkInputCondition condition)