mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Fix build failures under GTK 1.
My previous dodge to make the GTK 1 headers work with modern compilers was to manually reset to -std=gnu89, which changed the semantics of 'inline' back to what glib.h was expecting. But that doesn't work now the PuTTY code base expects to be able to use the rest of C99, so instead I have to manually override the specific #defines that glib.h uses to know how 'inline' works. Also, moved that code in configure.ac out of the fallback branch that manually detects GTK1, so that it will fire even if autoconf is run on a system that still has the genuine GTK1 detection code. (Amazingly, one still exists that I have access to!) With that fixed, there's one more problem: the nethack_mode and app_keypad_mode flags in gtkwin.c's key_event() are only used in the GTK >= 2 branch of the ifdefs, so they should only be declared and set in that branch as well, on pain of a -Wunused complaint.
This commit is contained in:
parent
ba91e4b996
commit
f098dc748d
19
configure.ac
19
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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user