[gtk+] configure: Check for XGetEventData()



commit e89d6b87417dbcb3c78b132b885bbeb2360ae6f7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri May 20 22:21:59 2011 +0200

    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(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 86b75c0..bb0865a 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 2c25c85..5825df1 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;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]