Add configure tests for faulty XI2 installations

* configure.ac: Detect cases where XI 2.4 headers are installed
without the correct event structures.
* src/xterm.c (handle_one_xevent): Don't use structures that
might not exist unless configure found them.
This commit is contained in:
Po Lu 2021-12-26 14:44:53 +08:00
parent 50484ad7d7
commit 62339e62d8
2 changed files with 9 additions and 0 deletions

View file

@ -4489,6 +4489,13 @@ if test "${HAVE_X11}" = "yes" && test "${with_xinput2}" != "no"; then
AC_MSG_WARN([You are building Emacs with GTK+ 2 and the X Input Extension version 2.
This might lead to problems if your version of GTK+ is not built with support for XInput 2.])
fi
# Detect both faulty installations of libXi where gesture event
# types are defined but gesture event structures are not, and
# also where gesture event structures are empty.
AC_CHECK_MEMBERS([XIGesturePinchEvent.delta_unaccel_y],
[AC_DEFINE(HAVE_USABLE_XI_GESTURE_PINCH_EVENT, 1,
[Define to 1 if XInput headers define gesture structures correctly.])],
[], [[#include <X11/extensions/XInput2.h>]])
fi
fi
AC_SUBST(XINPUT_CFLAGS)

View file

@ -11050,6 +11050,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
case XI_GesturePinchBegin:
case XI_GesturePinchUpdate:
{
#ifdef HAVE_USABLE_XI_GESTURE_PINCH_EVENT
XIGesturePinchEvent *pev = (XIGesturePinchEvent *) xi_event;
struct xi_device_t *device = xi_device_from_id (dpyinfo, pev->deviceid);
@ -11070,6 +11071,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
make_float (pev->scale),
make_float (pev->delta_angle));
}
#endif
/* Once again GTK seems to crash when confronted by
events it doesn't understand. */
*finish = X_EVENT_DROP;