diff options
| author | Po Lu | 2021-12-26 14:44:53 +0800 |
|---|---|---|
| committer | Po Lu | 2021-12-26 14:48:13 +0800 |
| commit | 62339e62d8480a9059e4f9f2e4bccdedcb60fc5e (patch) | |
| tree | e78fde4f120d70f6f0b89dbc06b6aa44acffaefb | |
| parent | 50484ad7d78acb8358fb7da5b19cd17ef060d74e (diff) | |
| download | emacs-62339e62d8480a9059e4f9f2e4bccdedcb60fc5e.tar.gz emacs-62339e62d8480a9059e4f9f2e4bccdedcb60fc5e.zip | |
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.
| -rw-r--r-- | configure.ac | 7 | ||||
| -rw-r--r-- | src/xterm.c | 2 |
2 files changed, 9 insertions, 0 deletions
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 | |||
| 4489 | AC_MSG_WARN([You are building Emacs with GTK+ 2 and the X Input Extension version 2. | 4489 | AC_MSG_WARN([You are building Emacs with GTK+ 2 and the X Input Extension version 2. |
| 4490 | This might lead to problems if your version of GTK+ is not built with support for XInput 2.]) | 4490 | This might lead to problems if your version of GTK+ is not built with support for XInput 2.]) |
| 4491 | fi | 4491 | fi |
| 4492 | # Detect both faulty installations of libXi where gesture event | ||
| 4493 | # types are defined but gesture event structures are not, and | ||
| 4494 | # also where gesture event structures are empty. | ||
| 4495 | AC_CHECK_MEMBERS([XIGesturePinchEvent.delta_unaccel_y], | ||
| 4496 | [AC_DEFINE(HAVE_USABLE_XI_GESTURE_PINCH_EVENT, 1, | ||
| 4497 | [Define to 1 if XInput headers define gesture structures correctly.])], | ||
| 4498 | [], [[#include <X11/extensions/XInput2.h>]]) | ||
| 4492 | fi | 4499 | fi |
| 4493 | fi | 4500 | fi |
| 4494 | AC_SUBST(XINPUT_CFLAGS) | 4501 | 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, | |||
| 11050 | case XI_GesturePinchBegin: | 11050 | case XI_GesturePinchBegin: |
| 11051 | case XI_GesturePinchUpdate: | 11051 | case XI_GesturePinchUpdate: |
| 11052 | { | 11052 | { |
| 11053 | #ifdef HAVE_USABLE_XI_GESTURE_PINCH_EVENT | ||
| 11053 | XIGesturePinchEvent *pev = (XIGesturePinchEvent *) xi_event; | 11054 | XIGesturePinchEvent *pev = (XIGesturePinchEvent *) xi_event; |
| 11054 | struct xi_device_t *device = xi_device_from_id (dpyinfo, pev->deviceid); | 11055 | struct xi_device_t *device = xi_device_from_id (dpyinfo, pev->deviceid); |
| 11055 | 11056 | ||
| @@ -11070,6 +11071,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 11070 | make_float (pev->scale), | 11071 | make_float (pev->scale), |
| 11071 | make_float (pev->delta_angle)); | 11072 | make_float (pev->delta_angle)); |
| 11072 | } | 11073 | } |
| 11074 | #endif | ||
| 11073 | /* Once again GTK seems to crash when confronted by | 11075 | /* Once again GTK seems to crash when confronted by |
| 11074 | events it doesn't understand. */ | 11076 | events it doesn't understand. */ |
| 11075 | *finish = X_EVENT_DROP; | 11077 | *finish = X_EVENT_DROP; |