diff --git a/configure.ac b/configure.ac index 1d614d31..9548ba87 100644 --- a/configure.ac +++ b/configure.ac @@ -122,17 +122,28 @@ case "$gtk_version_desired:$gtk" in # manual check for gtk1 AC_PATH_PROG(GTK1_CONFIG, gtk-config, absent) if test "$GTK1_CONFIG" != "absent"; then - # the gtk1 headers need -std=gnu89, which flips round the - # definitions of 'inline' and 'extern inline' to their old GNU - # semantics before C99 chose different ones - GTK_CFLAGS="`"$GTK1_CONFIG" --cflags` -std=gnu89" + GTK_CFLAGS="`"$GTK1_CONFIG" --cflags`" GTK_LIBS=`"$GTK1_CONFIG" --libs` + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) gtk=1 fi ]) ;; esac +case "$gtk" in + 1) + # Add some manual #defines to make the GTK 1 headers work when + # compiling in C99 mode. Left to themselves, they'll expect the + # old-style pre-C99 GNU semantics of 'inline' and 'extern inline', + # with the effect that they'll end up defining out-of-line + # versions of the inlined functions in more than one translation + # unit and cause a link failure. Override them to 'static inline', + # which is safe. + GTK_CFLAGS="$GTK_CFLAGS -DG_INLINE_FUNC='static inline' -DG_CAN_INLINE=1" +esac + AM_CONDITIONAL(HAVE_GTK, [test "$gtk" != "none"]) if test "$gtk" = "2" -o "$gtk" = "3"; then diff --git a/unix/gtkwin.c b/unix/gtkwin.c index f954279f..bf0d9582 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -990,7 +990,6 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) wchar_t ucsoutput[2]; int ucsval, start, end, output_charset; bool special, use_ucsoutput; - bool nethack_mode, app_keypad_mode; bool force_format_numeric_keypad = false; bool generated_something = false; char num_keypad_key = '\0'; @@ -1392,10 +1391,6 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) special = false; use_ucsoutput = false; - nethack_mode = conf_get_bool(inst->conf, CONF_nethack_keypad); - app_keypad_mode = (inst->term->app_keypad_keys && - !conf_get_bool(inst->conf, CONF_no_applic_k)); - /* ALT+things gives leading Escape. */ output[0] = '\033'; #if !GTK_CHECK_VERSION(2,0,0) @@ -1418,6 +1413,10 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) * it to. */ bool numeric = false; + bool nethack_mode = conf_get_bool(inst->conf, CONF_nethack_keypad); + bool app_keypad_mode = (inst->term->app_keypad_keys && + !conf_get_bool(inst->conf, CONF_no_applic_k)); + switch (event->keyval) { case GDK_KEY_Num_Lock: num_keypad_key = 'G'; break; case GDK_KEY_KP_Divide: num_keypad_key = '/'; break;