[clutter/clutter-1.16] x11: Remove support for XInput 1



commit e38ea7a20f6c1beae593d998c4aa6116930d0332
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jul 10 16:31:57 2013 -0400

    x11: Remove support for XInput 1
    
    Now we either use core X11 or XInput 2.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703969

 clutter/config.h.win32.in                     |    3 -
 clutter/x11/clutter-backend-x11.c             |   31 +--
 clutter/x11/clutter-device-manager-core-x11.c |  230 ---------------
 clutter/x11/clutter-input-device-core-x11.c   |  373 -------------------------
 clutter/x11/clutter-input-device-core-x11.h   |    5 -
 configure.ac                                  |    6 -
 6 files changed, 7 insertions(+), 641 deletions(-)
---
diff --git a/clutter/config.h.win32.in b/clutter/config.h.win32.in
index 798bfcb..d3583bf 100644
--- a/clutter/config.h.win32.in
+++ b/clutter/config.h.win32.in
@@ -117,9 +117,6 @@
 /* Define to 1 if X Generic Extensions is available */
 /* #undef HAVE_XGE */
 
-/* Define to 1 if XInput is available */
-/*#undef HAVE_XINPUT*/
-
 /* Define to 1 if XI2 is available */
 /*#undef HAVE_XINPUT_2*/
 
diff --git a/clutter/x11/clutter-backend-x11.c b/clutter/x11/clutter-backend-x11.c
index 6d9d9d4..5ca1a0b 100644
--- a/clutter/x11/clutter-backend-x11.c
+++ b/clutter/x11/clutter-backend-x11.c
@@ -50,10 +50,6 @@
 #include <X11/extensions/Xcomposite.h>
 #endif
 
-#if HAVE_XINPUT
-#include <X11/extensions/XInput.h>
-#endif
-
 #if HAVE_XINPUT_2
 #include <X11/extensions/XInput2.h>
 #endif
@@ -226,7 +222,7 @@ clutter_backend_x11_create_device_manager (ClutterBackendX11 *backend_x11)
   ClutterEventTranslator *translator;
   ClutterBackend *backend;
 
-#if defined(HAVE_XINPUT) || defined(HAVE_XINPUT_2)
+#ifdef HAVE_XINPUT_2
   if (clutter_enable_xinput)
     {
       int event_base, first_event, first_error;
@@ -236,7 +232,6 @@ clutter_backend_x11_create_device_manager (ClutterBackendX11 *backend_x11)
                            &first_event,
                            &first_error))
         {
-#ifdef HAVE_XINPUT_2
           int major = 2;
           int minor = 3;
 
@@ -252,23 +247,11 @@ clutter_backend_x11_create_device_manager (ClutterBackendX11 *backend_x11)
 
               backend_x11->xi_minor = minor;
             }
-          else
-#endif /* HAVE_XINPUT_2 */
-            {
-              CLUTTER_NOTE (BACKEND, "Creating Core+XI device manager");
-              backend_x11->has_xinput = TRUE;
-              backend_x11->device_manager =
-                g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_X11,
-                              "backend", backend_x11,
-                              "event-base", first_event,
-                              NULL);
-
-              backend_x11->xi_minor = -1;
-            }
         }
     }
-  else
-#endif /* HAVE_XINPUT || HAVE_XINPUT_2 */
+
+  if (backend_x11->device_manager == NULL)
+#endif /* HAVE_XINPUT_2 */
     {
       CLUTTER_NOTE (BACKEND, "Creating Core device manager");
       backend_x11->has_xinput = FALSE;
@@ -515,14 +498,14 @@ static const GOptionEntry entries[] =
     G_OPTION_ARG_NONE, &clutter_synchronise,
     N_("Make X calls synchronous"), NULL
   },
-#if defined(HAVE_XINPUT) || defined(HAVE_XINPUT_2)
+#ifdef HAVE_XINPUT_2
   {
     "disable-xinput", 0,
     G_OPTION_FLAG_REVERSE,
     G_OPTION_ARG_NONE, &clutter_enable_xinput,
     N_("Disable XInput support"), NULL
   },
-#endif /* HAVE_XINPUT */
+#endif /* HAVE_XINPUT_2 */
   { NULL }
 };
 
@@ -1189,7 +1172,7 @@ clutter_x11_get_input_devices (void)
 gboolean
 clutter_x11_has_xinput (void)
 {
-#if defined(HAVE_XINPUT) || defined(HAVE_XINPUT_2)
+#ifdef HAVE_XINPUT_2
  ClutterBackend *backend = clutter_get_default_backend ();
 
   if (backend == NULL)
diff --git a/clutter/x11/clutter-device-manager-core-x11.c b/clutter/x11/clutter-device-manager-core-x11.c
index f470189..6a3606d 100644
--- a/clutter/x11/clutter-device-manager-core-x11.c
+++ b/clutter/x11/clutter-device-manager-core-x11.c
@@ -37,17 +37,6 @@
 #include "clutter-stage-private.h"
 #include "clutter-private.h"
 
-#ifdef HAVE_XINPUT
-#include <X11/extensions/XInput.h>
-
-/* old versions of XI.h don't define these */
-#ifndef IsXExtensionKeyboard
-#define IsXExtensionKeyboard 3
-#define IsXExtensionPointer  4
-#endif
-
-#endif /* HAVE_XINPUT */
-
 enum
 {
   PROP_0,
@@ -69,146 +58,6 @@ G_DEFINE_TYPE_WITH_CODE (ClutterDeviceManagerX11,
                          G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_EVENT_TRANSLATOR,
                                                 clutter_event_translator_iface_init));
 
-#ifdef HAVE_XINPUT
-static void
-translate_class_info (ClutterInputDevice *device,
-                      XDeviceInfo        *info)
-{
-  XAnyClassPtr any_class;
-  gint i;
-
-  any_class = info->inputclassinfo;
-
-  for (i = 0; i < info->num_classes; i++)
-    {
-      switch (any_class->class)
-        {
-        case ButtonClass:
-          break;
-
-        case KeyClass:
-          {
-            XKeyInfo *xk_info = (XKeyInfo *) any_class;
-            ClutterInputDeviceX11 *device_x11;
-            guint n_keys;
-
-            device_x11 = CLUTTER_INPUT_DEVICE_X11 (device);
-
-            n_keys = xk_info->max_keycode - xk_info->min_keycode + 1;
-
-            _clutter_input_device_set_n_keys (device, n_keys);
-            _clutter_input_device_x11_set_keycodes (device_x11,
-                                                    xk_info->min_keycode,
-                                                    xk_info->max_keycode);
-          }
-          break;
-
-        case ValuatorClass:
-          {
-            XValuatorInfo *xv_info = (XValuatorInfo *) any_class;
-            gint j;
-
-            for (j = 0; j < xv_info->num_axes; j++)
-              {
-                ClutterInputAxis axis;
-
-                switch (j)
-                  {
-                  case 0:
-                    axis = CLUTTER_INPUT_AXIS_X;
-                    break;
-
-                  case 1:
-                    axis = CLUTTER_INPUT_AXIS_Y;
-                    break;
-
-                  case 2:
-                    axis = CLUTTER_INPUT_AXIS_PRESSURE;
-                    break;
-
-                  case 3:
-                    axis = CLUTTER_INPUT_AXIS_XTILT;
-                    break;
-
-                  case 4:
-                    axis = CLUTTER_INPUT_AXIS_YTILT;
-                    break;
-
-                  case 5:
-                    axis = CLUTTER_INPUT_AXIS_WHEEL;
-                    break;
-
-                  default:
-                    axis = CLUTTER_INPUT_AXIS_IGNORE;
-                    break;
-                  }
-
-                _clutter_input_device_add_axis (device, axis,
-                                                xv_info->axes[j].min_value,
-                                                xv_info->axes[j].max_value,
-                                                xv_info->axes[j].resolution);
-              }
-          }
-          break;
-        }
-
-      any_class = (XAnyClassPtr) (((char *) any_class) + any_class->length);
-    }
-}
-
-static ClutterInputDevice *
-create_device (ClutterDeviceManagerX11 *manager_x11,
-               ClutterBackendX11       *backend_x11,
-               XDeviceInfo             *info)
-{
-  ClutterInputDeviceType source;
-  ClutterInputDevice *retval;
-
-  if (info->use != IsXExtensionPointer &&
-      info->use != IsXExtensionKeyboard)
-    return NULL;
-
-  if (info->use == IsXExtensionKeyboard)
-    source = CLUTTER_KEYBOARD_DEVICE;
-  else
-    {
-      gchar *name;
-
-      name = g_ascii_strdown (info->name, -1);
-
-      if (strstr (name, "eraser") != NULL)
-        source = CLUTTER_ERASER_DEVICE;
-      else if (strstr (name, "cursor") != NULL)
-        source = CLUTTER_CURSOR_DEVICE;
-      else if (strstr (name, "wacom") != NULL || strstr (name, "pen") != NULL)
-        source = CLUTTER_PEN_DEVICE;
-      else
-        source = CLUTTER_POINTER_DEVICE;
-
-      g_free (name);
-    }
-
-  retval = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_X11,
-                         "name", info->name,
-                         "id", info->id,
-                         "has-cursor", FALSE,
-                         "device-manager", manager_x11,
-                         "device-type", source,
-                         "device-mode", CLUTTER_INPUT_MODE_FLOATING,
-                         "backend", backend_x11,
-                         "enabled", FALSE,
-                         NULL);
-  translate_class_info (retval, info);
-
-  CLUTTER_NOTE (BACKEND,
-                "XI Device '%s' (id: %d) created",
-                info->name,
-                (int) info->id);
-
-  return retval;
-}
-#endif /* HAVE_XINPUT */
-
 static inline void
 translate_key_event (ClutterBackendX11       *backend_x11,
                      ClutterDeviceManagerX11 *manager_x11,
@@ -275,20 +124,6 @@ out:
   return;
 }
 
-#ifdef HAVE_XINPUT
-static ClutterInputDevice *
-get_device_from_event (ClutterDeviceManagerX11 *manager_x11,
-                       XEvent                  *xevent)
-{
-  guint32 device_id;
-
-  device_id = ((XDeviceButtonEvent *) xevent)->deviceid;
-
-  return g_hash_table_lookup (manager_x11->devices_by_id,
-                              GINT_TO_POINTER (device_id));
-}
-#endif /* HAVE_XINPUT */
-
 static ClutterTranslateReturn
 clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
                                             gpointer                native,
@@ -300,9 +135,6 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
   ClutterTranslateReturn res;
   ClutterStage *stage;
   XEvent *xevent;
-#ifdef HAVE_XINPUT
-  ClutterInputDevice *device;
-#endif
 
   manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (translator);
   backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
@@ -322,23 +154,6 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
 
   res = CLUTTER_TRANSLATE_CONTINUE;
 
-#ifdef HAVE_XINPUT
-  device = get_device_from_event (manager_x11, xevent);
-  if (device != NULL)
-    {
-      ClutterInputDeviceX11 *device_x11;
-      gboolean retval;
-
-      device_x11 = CLUTTER_INPUT_DEVICE_X11 (device);
-      retval = _clutter_input_device_x11_translate_xi_event (device_x11,
-                                                             stage_x11,
-                                                             xevent,
-                                                             event);
-      if (retval)
-        return CLUTTER_TRANSLATE_QUEUE;
-    }
-#endif /* HAVE_XINPUT */
-
   switch (xevent->type)
     {
     case KeyPress:
@@ -537,57 +352,12 @@ clutter_device_manager_x11_constructed (GObject *gobject)
 {
   ClutterDeviceManagerX11 *manager_x11;
   ClutterBackendX11 *backend_x11;
-#ifdef HAVE_XINPUT
-  ClutterDeviceManager *manager;
-  XDeviceInfo *x_devices = NULL;
-  int i, n_devices;
-#endif /* HAVE_XINPUT */
 
   manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (gobject);
 
   g_object_get (gobject, "backend", &backend_x11, NULL);
   g_assert (backend_x11 != NULL);
 
-#ifdef HAVE_XINPUT
-  manager = CLUTTER_DEVICE_MANAGER (gobject);
-  x_devices = XListInputDevices (backend_x11->xdpy, &n_devices);
-  if (n_devices == 0)
-    {
-      CLUTTER_NOTE (BACKEND, "No XInput devices found");
-      goto default_device;
-    }
-
-  for (i = 0; i < n_devices; i++)
-    {
-      XDeviceInfo *info = x_devices + i;
-      ClutterInputDevice *device;
-
-      CLUTTER_NOTE (BACKEND,
-                    "Considering device %li with type %d, %d of %d",
-                    info->id,
-                    info->use,
-                    i, n_devices);
-
-      device = create_device (manager_x11, backend_x11, info);
-      if (device != NULL)
-        _clutter_device_manager_add_device (manager, device);
-    }
-
-  XFreeDeviceList (x_devices);
-
-default_device:
-#endif /* HAVE_XINPUT */
-
-  /* fallback code in case:
-   *
-   *  - we do not have XInput support compiled in
-   *  - we do not have the XInput extension
-   *
-   * we register two default devices, one for the pointer
-   * and one for the keyboard. this block must also be
-   * executed for the XInput support because XI does not
-   * cover core devices
-   */
   manager_x11->core_pointer =
     g_object_new (CLUTTER_TYPE_INPUT_DEVICE_X11,
                   "name", "Core Pointer",
diff --git a/clutter/x11/clutter-input-device-core-x11.c b/clutter/x11/clutter-input-device-core-x11.c
index 6c78a30..0835c17 100644
--- a/clutter/x11/clutter-input-device-core-x11.c
+++ b/clutter/x11/clutter-input-device-core-x11.c
@@ -33,12 +33,6 @@
 #include "clutter-backend-x11.h"
 #include "clutter-stage-x11.h"
 
-#ifdef HAVE_XINPUT
-#include <X11/extensions/XInput.h>
-#endif
-
-#define MAX_DEVICE_CLASSES      13
-
 typedef struct _ClutterInputDeviceClass         ClutterInputDeviceX11Class;
 
 /* a specific X11 input device */
@@ -46,22 +40,6 @@ struct _ClutterInputDeviceX11
 {
   ClutterInputDevice device;
 
-#ifdef HAVE_XINPUT
-  XDevice *xdevice;
-
-  XEventClass event_classes[MAX_DEVICE_CLASSES];
-  int num_classes;
-
-  int button_press_type;
-  int button_release_type;
-  int motion_notify_type;
-  int state_notify_type;
-  int key_press_type;
-  int key_release_type;
-#endif /* HAVE_XINPUT */
-
-  gint *axis_data;
-
   int min_keycode;
   int max_keycode;
 };
@@ -72,134 +50,6 @@ G_DEFINE_TYPE (ClutterInputDeviceX11,
                clutter_input_device_x11,
                CLUTTER_TYPE_INPUT_DEVICE);
 
-static void
-clutter_input_device_x11_select_stage_events (ClutterInputDevice *device,
-                                              ClutterStage       *stage,
-                                              gint                event_mask)
-{
-#if HAVE_XINPUT
-  ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (device->backend);
-  ClutterInputDeviceX11 *device_x11;
-  ClutterStageX11 *stage_x11;
-  XEventClass class;
-  gint i;
-
-  device_x11 = CLUTTER_INPUT_DEVICE_X11 (device);
-
-  stage_x11 = CLUTTER_STAGE_X11 (_clutter_stage_get_window (stage));
-
-  i = 0;
-
-  if (event_mask & ButtonPressMask)
-    {
-      DeviceButtonPress (device_x11->xdevice,
-                         device_x11->button_press_type,
-                         class);
-      if (class != 0)
-        device_x11->event_classes[i++] = class;
-
-      DeviceButtonPressGrab (device_x11->xdevice, 0, class);
-      if (class != 0)
-        device_x11->event_classes[i++] = class;
-    }
-
-  if (event_mask & ButtonReleaseMask)
-    {
-      DeviceButtonRelease (device_x11->xdevice,
-                           device_x11->button_release_type,
-                           class);
-      if (class != 0)
-        device_x11->event_classes[i++] = class;
-    }
-
-  if (event_mask & PointerMotionMask)
-    {
-      DeviceMotionNotify (device_x11->xdevice,
-                          device_x11->motion_notify_type,
-                          class);
-      if (class != 0)
-        device_x11->event_classes[i++] = class;
-
-      DeviceStateNotify (device_x11->xdevice,
-                         device_x11->state_notify_type,
-                         class);
-      if (class != 0)
-        device_x11->event_classes[i++] = class;
-    }
-
-  if (event_mask & KeyPressMask)
-    {
-      DeviceKeyPress (device_x11->xdevice,
-                      device_x11->key_press_type,
-                      class);
-      if (class != 0)
-        device_x11->event_classes[i++] = class;
-    }
-
-  if (event_mask & KeyReleaseMask)
-    {
-      DeviceKeyRelease (device_x11->xdevice,
-                        device_x11->key_release_type,
-                        class);
-      if (class != 0)
-        device_x11->event_classes[i++] = class;
-    }
-
-  device_x11->num_classes = i;
-
-  XSelectExtensionEvent (backend_x11->xdpy,
-                         stage_x11->xwin,
-                         device_x11->event_classes,
-                         device_x11->num_classes);
-#endif /* HAVE_XINPUT */
-}
-
-static void
-clutter_input_device_x11_dispose (GObject *gobject)
-{
-  ClutterInputDeviceX11 *device_x11 = CLUTTER_INPUT_DEVICE_X11 (gobject);
-
-#ifdef HAVE_XINPUT
-  if (device_x11->xdevice)
-    {
-      ClutterInputDevice *device = CLUTTER_INPUT_DEVICE (gobject);
-      ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (device->backend);
-
-      XCloseDevice (backend_x11->xdpy, device_x11->xdevice);
-      device_x11->xdevice = NULL;
-    }
-#endif /* HAVE_XINPUT */
-
-  g_free (device_x11->axis_data);
-
-  G_OBJECT_CLASS (clutter_input_device_x11_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_input_device_x11_constructed (GObject *gobject)
-{
-#ifdef HAVE_XINPUT
-  ClutterInputDeviceX11 *device_x11 = CLUTTER_INPUT_DEVICE_X11 (gobject);
-  ClutterInputDevice *device = CLUTTER_INPUT_DEVICE (gobject);
-  ClutterBackendX11 *backend_x11;
-
-  backend_x11 = CLUTTER_BACKEND_X11 (device->backend);
-
-  clutter_x11_trap_x_errors ();
-
-  device_x11->xdevice = XOpenDevice (backend_x11->xdpy, device->id);
-
-  if (clutter_x11_untrap_x_errors ())
-    {
-      g_warning ("Device '%s' cannot be opened",
-                 clutter_input_device_get_device_name (device));
-    }
-#endif /* HAVE_XINPUT */
-
-  if (G_OBJECT_CLASS (clutter_input_device_x11_parent_class)->constructed)
-    G_OBJECT_CLASS (clutter_input_device_x11_parent_class)->constructed (gobject);
-}
-
 static gboolean
 clutter_input_device_x11_keycode_to_evdev (ClutterInputDevice *device,
                                            guint hardware_keycode,
@@ -220,10 +70,6 @@ clutter_input_device_x11_class_init (ClutterInputDeviceX11Class *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   ClutterInputDeviceClass *device_class = CLUTTER_INPUT_DEVICE_CLASS (klass);
 
-  gobject_class->constructed = clutter_input_device_x11_constructed;
-  gobject_class->dispose = clutter_input_device_x11_dispose;
-
-  device_class->select_stage_events = clutter_input_device_x11_select_stage_events;
   device_class->keycode_to_evdev = clutter_input_device_x11_keycode_to_evdev;
 }
 
@@ -252,222 +98,3 @@ _clutter_input_device_x11_get_max_keycode (ClutterInputDeviceX11 *device_x11)
 {
   return device_x11->max_keycode;
 }
-
-#ifdef HAVE_XINPUT
-static void
-update_axes (ClutterInputDeviceX11 *device_x11,
-             guint                  n_axes,
-             gint                   first_axis,
-             gint                  *axes_data)
-{
-  ClutterInputDevice *device = CLUTTER_INPUT_DEVICE (device_x11);
-  gint i;
-
-  if (device_x11->axis_data == NULL)
-    {
-      device_x11->axis_data =
-        g_new0 (gint, clutter_input_device_get_n_axes (device));
-    }
-
-  for (i = 0; i < n_axes; i++)
-    device_x11->axis_data[first_axis + i] = axes_data[i];
-}
-
-static gdouble *
-translate_axes (ClutterInputDeviceX11 *device_x11,
-                ClutterStageX11       *stage_x11,
-                gfloat                *event_x,
-                gfloat                *event_y)
-{
-  ClutterInputDevice *device = CLUTTER_INPUT_DEVICE (device_x11);
-  gint root_x, root_y;
-  gint n_axes, i;
-  gdouble x, y;
-  gdouble *retval;
-
-  if (!_clutter_stage_x11_get_root_coords (stage_x11, &root_x, &root_y))
-    return NULL;
-
-  x = y = 0.0f;
-  n_axes = clutter_input_device_get_n_axes (device);
-
-  retval = g_new0 (gdouble, n_axes);
-
-  for (i = 0; i < n_axes; i++)
-    {
-      ClutterInputAxis axis;
-
-      axis = clutter_input_device_get_axis (device, i);
-      switch (axis)
-        {
-        case CLUTTER_INPUT_AXIS_X:
-        case CLUTTER_INPUT_AXIS_Y:
-          _clutter_x11_input_device_translate_screen_coord (device,
-                                                            root_x, root_y,
-                                                            i,
-                                                            device_x11->axis_data[i],
-                                                            &retval[i]);
-          if (axis == CLUTTER_INPUT_AXIS_X)
-            x = retval[i];
-          else if (axis == CLUTTER_INPUT_AXIS_Y)
-            y = retval[i];
-          break;
-
-        default:
-          _clutter_input_device_translate_axis (device, i,
-                                                device_x11->axis_data[i],
-                                                &retval[i]);
-          break;
-        }
-    }
-
-  if (event_x)
-    *event_x = x;
-
-  if (event_y)
-    *event_y = y;
-
-  return retval;
-}
-
-/*
- * translate_state:
- * @state: the keyboard state of the core device
- * @device_state: the button state of the device
- *
- * Trivially translates the state and the device state into a
- * single bitmask.
- */
-static guint
-translate_state (guint state,
-                 guint device_state)
-{
-  return device_state | (state & 0xff);
-}
-#endif /* HAVE_XINPUT */
-
-gboolean
-_clutter_input_device_x11_translate_xi_event (ClutterInputDeviceX11 *device_x11,
-                                              ClutterStageX11       *stage_x11,
-                                              XEvent                *xevent,
-                                              ClutterEvent          *event)
-{
-#ifdef HAVE_XINPUT
-  ClutterInputDevice *device = CLUTTER_INPUT_DEVICE (device_x11);
-
-  if ((xevent->type == device_x11->button_press_type) ||
-      (xevent->type == device_x11->button_release_type))
-    {
-      XDeviceButtonEvent *xdbe = (XDeviceButtonEvent *) xevent;
-
-      event->button.type = event->type =
-        (xdbe->type == device_x11->button_press_type) ? CLUTTER_BUTTON_PRESS
-                                                      : CLUTTER_BUTTON_RELEASE;
-      event->button.device = device;
-      event->button.time = xdbe->time;
-      event->button.button = xdbe->button;
-      event->button.modifier_state =
-        translate_state (xdbe->state, xdbe->device_state);
-
-      update_axes (device_x11,
-                   xdbe->axes_count,
-                   xdbe->first_axis,
-                   xdbe->axis_data);
-
-      event->button.axes = translate_axes (device_x11, stage_x11,
-                                           &event->button.x,
-                                           &event->button.y);
-
-      _clutter_stage_x11_set_user_time (stage_x11, event->button.time);
-
-      return TRUE;
-    }
-
-  if ((xevent->type == device_x11->key_press_type) ||
-      (xevent->type == device_x11->key_release_type))
-    {
-      XDeviceKeyEvent *xdke = (XDeviceKeyEvent *) xevent;
-
-      if (xdke->keycode < device_x11->min_keycode ||
-          xdke->keycode >= device_x11->max_keycode)
-        {
-          g_warning ("Invalid device key code received: %d", xdke->keycode);
-          return FALSE;
-        }
-
-      clutter_input_device_get_key (device,
-                                    xdke->keycode - device_x11->min_keycode,
-                                    &event->key.keyval,
-                                    &event->key.modifier_state);
-      if (event->key.keyval == 0)
-        return FALSE;
-
-      event->key.type = event->type =
-        (xdke->type == device_x11->key_press_type) ? CLUTTER_KEY_PRESS
-                                                   : CLUTTER_KEY_RELEASE;
-      event->key.time = xdke->time;
-      event->key.modifier_state |=
-        translate_state (xdke->state, xdke->device_state);
-      event->key.device = device;
-
-#if 0
-      if ((event->key.keyval >= 0x20) && (event->key.keyval <= 0xff))
-        {
-          event->key.unicode = (gunichar) event->key.keyval;
-        }
-#endif
-
-      _clutter_stage_x11_set_user_time (stage_x11, event->key.time);
-
-      return TRUE;
-    }
-
-  if (xevent->type == device_x11->motion_notify_type)
-    {
-      XDeviceMotionEvent *xdme = (XDeviceMotionEvent *) xevent;
-
-      event->motion.type = event->type = CLUTTER_MOTION;
-      event->motion.time = xdme->time;
-      event->motion.modifier_state =
-        translate_state (xdme->state, xdme->device_state);
-      event->motion.device = device;
-
-      event->motion.axes =
-        g_new0 (gdouble, clutter_input_device_get_n_axes (device));
-
-      update_axes (device_x11,
-                   xdme->axes_count,
-                   xdme->first_axis,
-                   xdme->axis_data);
-
-      event->motion.axes = translate_axes (device_x11, stage_x11,
-                                           &event->motion.x,
-                                           &event->motion.y);
-
-      return TRUE;
-    }
-
-  if (xevent->type == device_x11->state_notify_type)
-    {
-      XDeviceStateNotifyEvent *xdse = (XDeviceStateNotifyEvent *) xevent;
-      XInputClass *input_class = (XInputClass *) xdse->data;
-      gint n_axes = clutter_input_device_get_n_axes (device);
-      int i;
-
-      for (i = 0; i < xdse->num_classes; i++)
-        {
-          if (input_class->class == ValuatorClass)
-            {
-              int *axis_data = ((XValuatorState *) input_class)->valuators;
-
-              update_axes (device_x11, n_axes, 0, axis_data);
-            }
-
-          input_class =
-            (XInputClass *)(((char *) input_class) + input_class->length);
-        }
-    }
-#endif /* HAVE_XINPUT */
-
-  return FALSE;
-}
diff --git a/clutter/x11/clutter-input-device-core-x11.h b/clutter/x11/clutter-input-device-core-x11.h
index af4ed59..ce6b125 100644
--- a/clutter/x11/clutter-input-device-core-x11.h
+++ b/clutter/x11/clutter-input-device-core-x11.h
@@ -45,11 +45,6 @@ void _clutter_input_device_x11_set_keycodes (ClutterInputDeviceX11 *device_x11,
 int _clutter_input_device_x11_get_min_keycode (ClutterInputDeviceX11 *device_x11);
 int _clutter_input_device_x11_get_max_keycode (ClutterInputDeviceX11 *device_x11);
 
-gboolean _clutter_input_device_x11_translate_xi_event (ClutterInputDeviceX11 *device_x11,
-                                                       ClutterStageX11       *stage_x11,
-                                                       XEvent                *xevent,
-                                                       ClutterEvent          *event);
-
 G_END_DECLS
 
 #endif /* __CLUTTER_INPUT_DEVICE_X11_H__ */
diff --git a/configure.ac b/configure.ac
index 69a3307..0c08a08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -723,12 +723,6 @@ AS_IF([test "x$SUPPORT_X11" = "x1"],
                                      AC_DEFINE([HAVE_XINPUT_2],
                                                [1],
                                                [Define to 1 if XI2 is available])
-                                   ],
-                                   [
-                                     have_xinput2=no
-                                     AC_DEFINE([HAVE_XINPUT],
-                                               [1],
-                                               [Define to 1 if XInput is available])
                                    ])
 
                   clutter_save_LIBS="$LIBS"


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