From: Po Lu Date: Sun, 26 Dec 2021 06:44:53 +0000 (+0800) Subject: Add configure tests for faulty XI2 installations X-Git-Tag: emacs-29.0.90~3445 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=62339e62d8480a9059e4f9f2e4bccdedcb60fc5e;p=emacs.git 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. --- diff --git a/configure.ac b/configure.ac index 9fcc124758d..5b94fc8e1b7 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]]) fi fi AC_SUBST(XINPUT_CFLAGS) diff --git a/src/xterm.c b/src/xterm.c index 00cb04f005d..8ba4f46c2c9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -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;