[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 62339e62d8 2/2: Add configure tests for faulty XI2 installations
From: |
Po Lu |
Subject: |
master 62339e62d8 2/2: Add configure tests for faulty XI2 installations |
Date: |
Sun, 26 Dec 2021 01:48:27 -0500 (EST) |
branch: master
commit 62339e62d8480a9059e4f9f2e4bccdedcb60fc5e
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
configure.ac | 7 +++++++
src/xterm.c | 2 ++
2 files changed, 9 insertions(+)
diff --git a/configure.ac b/configure.ac
index 9fcc124758..5b94fc8e1b 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 <X11/extensions/XInput2.h>]])
fi
fi
AC_SUBST(XINPUT_CFLAGS)
diff --git a/src/xterm.c b/src/xterm.c
index 00cb04f005..8ba4f46c2c 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;