mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-21 06:55:39 +00:00
Improve XInput2 version checking
* configure.ac: Check for various important structures from all versions of libXi. * src/xfns.c (setup_xi_event_mask): * src/xwidget.c (x_draw_xwidget_glyph_string): * src/xterm.c (x_init_master_valuators, handle_one_xevent) (x_term_init): Replace XI version checks based on protocol headers with new constants. * src/xterm.h (HAVE_XINPUT2_1, HAVE_XINPUT2_2, HAVE_XINPUT2_3) (HAVE_XINPUT2_4): New definitions.
This commit is contained in:
parent
8d02624c0e
commit
c914572a46
14
configure.ac
14
configure.ac
@ -4478,13 +4478,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>]])
|
||||
|
||||
# Now check for some members (which used in conjunction with
|
||||
# protocol definitions) can be used to determine the version of
|
||||
# XInput supported.
|
||||
AC_CHECK_MEMBERS([XIScrollClassInfo.type, XITouchClassInfo.type,
|
||||
XIBarrierReleasePointerInfo.deviceid, XIGestureClassInfo.type],
|
||||
[], [], [#include <X11/extensions/XInput2.h>])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(XINPUT_CFLAGS)
|
||||
|
@ -3565,13 +3565,13 @@ setup_xi_event_mask (struct frame *f)
|
||||
XISetMask (m, XI_PropertyEvent);
|
||||
XISetMask (m, XI_HierarchyChanged);
|
||||
XISetMask (m, XI_DeviceChanged);
|
||||
#ifdef XI_TouchBegin
|
||||
#ifdef HAVE_XINPUT2_2
|
||||
if (FRAME_DISPLAY_INFO (f)->xi2_version >= 2)
|
||||
{
|
||||
XISetMask (m, XI_TouchBegin);
|
||||
XISetMask (m, XI_TouchUpdate);
|
||||
XISetMask (m, XI_TouchEnd);
|
||||
#ifdef XI_GesturePinchBegin
|
||||
#ifdef HAVE_XINPUT2_4
|
||||
if (FRAME_DISPLAY_INFO (f)->xi2_version >= 4)
|
||||
{
|
||||
XISetMask (m, XI_GesturePinchBegin);
|
||||
|
35
src/xterm.c
35
src/xterm.c
@ -629,7 +629,7 @@ x_init_master_valuators (struct x_display_info *dpyinfo)
|
||||
{
|
||||
switch (device->classes[c]->type)
|
||||
{
|
||||
#ifdef XIScrollClass /* XInput 2.1 */
|
||||
#ifdef HAVE_XINPUT2_1
|
||||
case XIScrollClass:
|
||||
{
|
||||
XIScrollClassInfo *info =
|
||||
@ -648,7 +648,7 @@ x_init_master_valuators (struct x_display_info *dpyinfo)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef XITouchClass /* XInput 2.2 */
|
||||
#ifdef HAVE_XINPUT2_2
|
||||
case XITouchClass:
|
||||
{
|
||||
XITouchClassInfo *info;
|
||||
@ -739,7 +739,7 @@ xi_device_from_id (struct x_display_info *dpyinfo, int deviceid)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef XI_TouchBegin
|
||||
#ifdef HAVE_XINPUT2_2
|
||||
|
||||
static void
|
||||
xi_link_touch_point (struct xi_device_t *device,
|
||||
@ -11046,7 +11046,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
||||
if (!device)
|
||||
goto XI_OTHER;
|
||||
|
||||
#ifdef XI_TouchBegin
|
||||
#ifdef HAVE_XINPUT2_2
|
||||
if (xev->flags & XIPointerEmulated)
|
||||
goto XI_OTHER;
|
||||
#endif
|
||||
@ -11929,7 +11929,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
||||
{
|
||||
struct xi_device_t *device;
|
||||
struct xi_touch_point_t *tem, *last;
|
||||
int c, i;
|
||||
int c;
|
||||
#ifdef HAVE_XINPUT2_1
|
||||
int i;
|
||||
#endif
|
||||
|
||||
device = xi_device_from_id (dpyinfo, device_changed->deviceid);
|
||||
|
||||
@ -11959,7 +11962,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
||||
{
|
||||
switch (device_changed->classes[c]->type)
|
||||
{
|
||||
#ifdef XIScrollClass
|
||||
#ifdef HAVE_XINPUT2_1
|
||||
case XIScrollClass:
|
||||
{
|
||||
XIScrollClassInfo *info;
|
||||
@ -11979,7 +11982,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XITouchClass
|
||||
#ifdef HAVE_XINPUT2_2
|
||||
case XITouchClass:
|
||||
{
|
||||
XITouchClassInfo *info;
|
||||
@ -11993,7 +11996,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XIScrollClass
|
||||
#ifdef HAVE_XINPUT2_1
|
||||
for (c = 0; c < device_changed->num_classes; ++c)
|
||||
{
|
||||
if (device_changed->classes[c]->type == XIValuatorClass)
|
||||
@ -12043,7 +12046,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
||||
goto XI_OTHER;
|
||||
}
|
||||
|
||||
#ifdef XI_TouchBegin
|
||||
#ifdef HAVE_XINPUT2_2
|
||||
case XI_TouchBegin:
|
||||
{
|
||||
struct xi_device_t *device;
|
||||
@ -12205,13 +12208,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef XI_GesturePinchBegin
|
||||
|
||||
#ifdef HAVE_XINPUT2_4
|
||||
case XI_GesturePinchBegin:
|
||||
case XI_GesturePinchUpdate:
|
||||
{
|
||||
x_display_set_last_user_time (dpyinfo, xi_event->time);
|
||||
|
||||
#ifdef HAVE_USABLE_XI_GESTURE_PINCH_EVENT
|
||||
XIGesturePinchEvent *pev = (XIGesturePinchEvent *) xi_event;
|
||||
struct xi_device_t *device = xi_device_from_id (dpyinfo, pev->deviceid);
|
||||
|
||||
@ -12243,7 +12246,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;
|
||||
@ -16261,13 +16264,13 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
||||
dpyinfo->supports_xi2 = false;
|
||||
int rc;
|
||||
int major = 2;
|
||||
#ifdef XI_GesturePinchBegin /* XInput 2.4 */
|
||||
#ifdef HAVE_XINPUT2_4
|
||||
int minor = 4;
|
||||
#elif XI_BarrierHit /* XInput 2.3 */
|
||||
#elif defined HAVE_XINPUT2_3 /* XInput 2.3 */
|
||||
int minor = 3;
|
||||
#elif defined XI_TouchBegin /* XInput 2.2 */
|
||||
#elif defined HAVE_XINPUT2_2 /* XInput 2.2 */
|
||||
int minor = 2;
|
||||
#elif defined XIScrollClass /* XInput 2.1 */
|
||||
#elif defined HAVE_XINPUT2_1 /* XInput 2.1 */
|
||||
int minor = 1;
|
||||
#else /* Some old version of XI2 we're not interested in. */
|
||||
int minor = 0;
|
||||
|
19
src/xterm.h
19
src/xterm.h
@ -42,6 +42,10 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
||||
#include <X11/Xmu/Editres.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XINPUT2
|
||||
#include <X11/extensions/XInput2.h>
|
||||
#endif
|
||||
|
||||
typedef Widget xt_or_gtk_widget;
|
||||
#endif
|
||||
|
||||
@ -1465,6 +1469,21 @@ struct xi_device_t *xi_device_from_id (struct x_display_info *, int);
|
||||
(nr).width = (rwidth), \
|
||||
(nr).height = (rheight))
|
||||
|
||||
#ifdef HAVE_XINPUT2
|
||||
#if HAVE_XISCROLLCLASSINFO_TYPE && defined XIScrollClass
|
||||
#define HAVE_XINPUT2_1
|
||||
#endif
|
||||
#if HAVE_XITOUCHCLASSINFO_TYPE && defined XITouchClass
|
||||
#define HAVE_XINPUT2_2
|
||||
#endif
|
||||
#if HAVE_XIBARRIERRELEASEPOINTERINFO_DEVICEID && defined XIBarrierPointerReleased
|
||||
#define HAVE_XINPUT2_3
|
||||
#endif
|
||||
#if HAVE_XIGESTURECLASSINFO_TYPE && defined XIGestureClass
|
||||
#define HAVE_XINPUT2_4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
INLINE_HEADER_END
|
||||
|
||||
#endif /* XTERM_H */
|
||||
|
@ -2853,7 +2853,7 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
|
||||
XISetMask (m, XI_ButtonRelease);
|
||||
XISetMask (m, XI_Enter);
|
||||
XISetMask (m, XI_Leave);
|
||||
#ifdef XI_GesturePinchBegin
|
||||
#ifdef HAVE_XINPUT2_4
|
||||
if (FRAME_DISPLAY_INFO (s->f)->xi2_version >= 4)
|
||||
{
|
||||
XISetMask (m, XI_GesturePinchBegin);
|
||||
|
Loading…
Reference in New Issue
Block a user