#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 */
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));
}
/*
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)