allow ecore_x to use auto-repeat detection - if its in xlib.
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 4 Feb 2009 00:05:42 +0000 (00:05 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 4 Feb 2009 00:05:42 +0000 (00:05 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@38932 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
src/lib/ecore_x/xlib/Makefile.am
src/lib/ecore_x/xlib/ecore_x.c
src/lib/ecore_x/xlib/ecore_x_private.h

index fc2e4c5..d9abf29 100644 (file)
@@ -435,6 +435,40 @@ if ! test "x$have_ecore_x_xcb" = "xyes" ; then
     AC_SUBST(Xcursor_cflags)
     AC_SUBST(Xcursor_libs)
 
+    Xkb_libs=""
+    Xkb_cflags=""
+    use_Xkb="no"
+    PCFLAGS=$CFLAGS
+    CFLAGS="$x_cflags $x_includes"
+    AC_CHECK_HEADER(X11/XKBlib.h,
+      [
+        AC_CHECK_LIB(X11, XkbSetDetectableAutoRepeat,
+          [
+            AC_DEFINE(ECORE_XKB, 1, [Build support for Xkb])
+            Xkb_cflags=""
+            Xkb_libs=""
+            use_Xkb="yes"
+          ], [
+            Xkb_cflags=""
+            Xkb_libs=""
+            use_Xkb="no"
+          ], [
+            $x_libs
+          ]
+        )
+      ], [
+        Xkb_cflags=""
+        Xkb_libs=""
+        use_Xkb="no"
+      ], [
+        #include <X11/XKBlib.h>
+      ]
+    )
+    CFLAGS=$PCFLAGS
+
+    AC_SUBST(Xkb_cflags)
+    AC_SUBST(Xkb_libs)
+
     ECORE_CHECK_X_EXTENSION([Xcomposite], [Xcomposite.h], [Xcomposite], [XCompositeQueryExtension])
     ECORE_CHECK_X_EXTENSION([Xdamage], [Xdamage.h], [Xdamage], [XDamageSubtract])
     ECORE_CHECK_X_EXTENSION([Xdpms], [dpms.h], [Xdpms], [DPMSQueryExtension])
@@ -1027,6 +1061,7 @@ if test "x$have_ecore_x" = "xyes" ; then
   else
     echo "  Ecore_X (Xlib backend).......: $have_ecore_x"
     echo "    Xcursor....................: $use_Xcursor"
+    echo "    Xkb........................: $use_Xkb"
     echo "    Xprint.....................: $use_xprint"
     echo "    Xinerama...................: $use_xinerama"
     echo "    Xrandr.....................: $use_xrandr"
index 4ebb57d..db4c8fa 100644 (file)
@@ -5,6 +5,7 @@ if BUILD_ECORE_X_XLIB
 
 AM_CPPFLAGS = \
 @Xcursor_cflags@ \
+@Xkb_cflags@ \
 @XDAMAGE_CFLAGS@ \
 @XCOMPOSITE_CFLAGS@ \
 @XDPMS_CFLAGS@ \
@@ -56,6 +57,7 @@ ecore_x_atoms.c
 
 libecore_x_xlib_la_LIBADD = \
 @Xcursor_libs@ \
+@Xkb_libs@ \
 @XDAMAGE_LIBS@ \
 @XCOMPOSITE_LIBS@ \
 @XDPMS_LIBS@ \
index ab4c58e..a10df81 100644 (file)
@@ -279,7 +279,19 @@ ecore_x_init(const char *name)
    if (_ecore_x_event_damage_id)
      _ecore_x_event_handlers[_ecore_x_event_damage_id] = _ecore_x_event_handle_damage_notify;
 #endif
-
+#ifdef ECORE_XKB
+   // set x autorepeat detection to on. that means instead of
+   //   press-release-press-release-press-release
+   // you get
+   //   press-press-press-press-press-release
+   do
+     {
+        Bool works = 0;
+        XkbSetDetectableAutoRepeat(_ecore_x_disp, 1, &works);
+     }
+   while (0);
+#endif
+   
    if (!ECORE_X_EVENT_KEY_DOWN)
      {
        ECORE_X_EVENT_KEY_DOWN                 = ecore_event_type_new();
index e2f9970..72142e1 100644 (file)
@@ -47,6 +47,9 @@
 #ifdef ECORE_XDPMS
 #include <X11/extensions/dpms.h>
 #endif
+#ifdef ECORE_XKB
+#include <X11/XKBlib.h>
+#endif
 
 #include "ecore_private.h"
 #include "Ecore_X.h"