From a285f830b66416a81f4c612345db46663509e7e8 Mon Sep 17 00:00:00 2001 From: jacob Date: Sun, 14 Mar 2010 18:58:20 +0000 Subject: [PATCH] r8854/5 broke compilation with Gtk 1.2. Grow a hack to cope. git-svn-id: svn://svn.tartarus.org/sgt/putty@8901 cda61777-01e9-0310-a592-d414129be87e --- unix/gtkwin.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 93e96da1..d08dffd4 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -34,6 +34,16 @@ #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) -- 2.11.0