From e89d6b87417dbcb3c78b132b885bbeb2360ae6f7 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 20 May 2011 22:21:59 +0200 Subject: [PATCH] configure: Check for XGetEventData() This is a call only available in recent libX11, only the XI2 code depends on this within GDK, but XI2 implies having GenericEvents available too. --- configure.ac | 4 ++++ gdk/x11/gdkeventsource.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/configure.ac b/configure.ac index 86b75c07d7..bb0865a138 100644 --- a/configure.ac +++ b/configure.ac @@ -1096,6 +1096,10 @@ if test "x$enable_x11_backend" = xyes; then fi fi + # Check for XGetEventData for GenericEvents + AC_CHECK_FUNC(XGetEventData, + AC_DEFINE(HAVE_XGENERICEVENTS, 1, [Have XGenericEvent])) + # set up things for XInput if test "x$enable_xinput" != "xno" && $PKG_CONFIG --exists "xi" ; then have_xinput=yes diff --git a/gdk/x11/gdkeventsource.c b/gdk/x11/gdkeventsource.c index 2c25c85db6..5825df1f0e 100644 --- a/gdk/x11/gdkeventsource.c +++ b/gdk/x11/gdkeventsource.c @@ -177,11 +177,13 @@ gdk_event_source_translate_event (GdkEventSource *event_source, dpy = GDK_DISPLAY_XDISPLAY (event_source->display); +#ifdef HAVE_XGENERICEVENTS /* Get cookie data here so it's available * to every event translator and event filter. */ if (xevent->type == GenericEvent) XGetEventData (dpy, &xevent->xcookie); +#endif filter_window = gdk_event_source_get_filter_window (event_source, xevent, &event_translator); @@ -204,8 +206,10 @@ gdk_event_source_translate_event (GdkEventSource *event_source, if (result != GDK_FILTER_CONTINUE) { +#ifdef HAVE_XGENERICEVENTS if (xevent->type == GenericEvent) XFreeEventData (dpy, &xevent->xcookie); +#endif if (result == GDK_FILTER_REMOVE) { @@ -250,8 +254,10 @@ gdk_event_source_translate_event (GdkEventSource *event_source, handle_focus_change (&event->crossing); } +#ifdef HAVE_XGENERICEVENTS if (xevent->type == GenericEvent) XFreeEventData (dpy, &xevent->xcookie); +#endif return event; }