[PATCH synaptics 08/10] Require xserver 1.12 and inputproto 2.2

Peter Hutterer peter.hutterer at who-t.net
Tue May 8 22:34:36 PDT 2012


This drops conditional compilation of multitouch support, smooth scrolling
support and old ABIs.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 configure.ac        |   13 ++---
 src/eventcomm.c     |   32 +------------
 src/properties.c    |    4 --
 src/synaptics.c     |  133 +++------------------------------------------------
 src/synapticsstr.h  |    8 ----
 src/synproto.c      |   12 -----
 src/synproto.h      |    2 -
 test/fake-symbols.c |   77 +++++++++++------------------
 test/fake-symbols.h |   81 ++++++++++---------------------
 9 files changed, 64 insertions(+), 298 deletions(-)

diff --git a/configure.ac b/configure.ac
index e5b92f9..102cc12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,7 @@ m4_ifndef([XORG_DRIVER_CHECK_EXT],
 XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
 
 # Obtain compiler/linker options for the Synaptics driver dependencies
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.7] xproto inputproto $REQUIRED_MODULES)
+PKG_CHECK_MODULES(XORG, [inputproto >= 2.1.99.3] [xorg-server >= 1.12] xproto inputproto $REQUIRED_MODULES)
 
 # X Server SDK location is required to install Synaptics header files
 # This location is also relayed in the xorg-synaptics.pc file
@@ -64,11 +64,6 @@ AC_SUBST([sdkdir])
 DRIVER_NAME=synaptics
 AC_SUBST([DRIVER_NAME])
 
-PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.99.901], HAVE_XI22="yes", HAVE_XI22="no")
-if test "x$HAVE_XI22" = xyes; then
-    AC_DEFINE(HAVE_MULTITOUCH, 1, [XI2.2 available])
-fi
-
 # -----------------------------------------------------------------------------
 #			Configuration options
 # -----------------------------------------------------------------------------
@@ -126,10 +121,8 @@ esac
 if test "x$BUILD_EVENTCOMM" = xyes; then
     AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled])
 
-    if test "x$HAVE_XI22" = xyes; then
-        # Obtain compiler/linker options for mtdev
-        PKG_CHECK_MODULES(MTDEV, mtdev)
-    fi
+    # Obtain compiler/linker options for mtdev
+    PKG_CHECK_MODULES(MTDEV, mtdev)
 fi
 if test "x$BUILD_PSMCOMM" = xyes; then
     AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled])
diff --git a/src/eventcomm.c b/src/eventcomm.c
index fc2fae0..4025eee 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -42,9 +42,7 @@
 #include "synaptics.h"
 #include "synapticsstr.h"
 #include <xf86.h>
-#ifdef HAVE_MULTITOUCH
 #include <mtdev.h>
-#endif
 
 #ifndef INPUT_PROP_BUTTONPAD
 #define INPUT_PROP_BUTTONPAD 0x02
@@ -73,13 +71,11 @@ struct eventcomm_proto_data {
     BOOL need_grab;
     int st_to_mt_offset[2];
     double st_to_mt_scale[2];
-#ifdef HAVE_MULTITOUCH
     struct mtdev *mtdev;
     int axis_map[MT_ABS_SIZE];
     int cur_slot;
     ValuatorMask **last_mt_vals;
     int num_touches;
-#endif
 };
 
 struct eventcomm_proto_data *
@@ -97,7 +93,6 @@ EventProtoDataAlloc(void)
     return proto_data;
 }
 
-#ifdef HAVE_MULTITOUCH
 static int
 last_mt_vals_slot(const SynapticsPrivate * priv)
 {
@@ -180,7 +175,6 @@ InitializeTouch(InputInfoPtr pInfo)
             valuator_mask_set(proto_data->last_mt_vals[i], 4 + j, 0);
     }
 }
-#endif
 
 static Bool
 EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para)
@@ -203,9 +197,7 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para)
 
     proto_data->need_grab = FALSE;
 
-#ifdef HAVE_MULTITOUCH
     InitializeTouch(pInfo);
-#endif
 
     return TRUE;
 }
@@ -213,9 +205,7 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para)
 static Bool
 EventDeviceOffHook(InputInfoPtr pInfo)
 {
-#ifdef HAVE_MULTITOUCH
     UninitializeTouch(pInfo);
-#endif
 
     return Success;
 }
@@ -416,7 +406,6 @@ event_query_axis_ranges(InputInfoPtr pInfo)
         event_get_abs(pInfo, pInfo->fd, ABS_TOOL_WIDTH,
                       &priv->minw, &priv->maxw, NULL, NULL);
 
-#if HAVE_MULTITOUCH
     if (priv->has_touch) {
         int st_minx = priv->minx;
         int st_maxx = priv->maxx;
@@ -435,7 +424,6 @@ event_query_axis_ranges(InputInfoPtr pInfo)
         proto_data->st_to_mt_scale[1] =
             (priv->maxy - priv->miny) / (st_maxy - st_miny);
     }
-#endif
 
     SYSCALL(rc = ioctl(pInfo->fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits));
     if (rc >= 0) {
@@ -502,19 +490,15 @@ EventQueryHardware(InputInfoPtr pInfo)
 static Bool
 SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev)
 {
-#ifdef HAVE_MULTITOUCH
     SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
     struct eventcomm_proto_data *proto_data = priv->proto_data;
-#endif
     int rc = TRUE;
     ssize_t len;
 
-#ifdef HAVE_MULTITOUCH
     if (proto_data->mtdev)
         len = mtdev_get(proto_data->mtdev, pInfo->fd, ev, 1) *
             sizeof(struct input_event);
     else
-#endif
         len = read(pInfo->fd, ev, sizeof(*ev));
     if (len <= 0) {
         /* We use X_NONE here because it doesn't alloc */
@@ -531,7 +515,6 @@ SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev)
     return rc;
 }
 
-#ifdef HAVE_MULTITOUCH
 static Bool
 EventTouchSlotPreviouslyOpen(SynapticsPrivate * priv, int slot)
 {
@@ -543,13 +526,11 @@ EventTouchSlotPreviouslyOpen(SynapticsPrivate * priv, int slot)
 
     return FALSE;
 }
-#endif
 
 static void
 EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw,
                        struct input_event *ev)
 {
-#ifdef HAVE_MULTITOUCH
     SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
     struct eventcomm_proto_data *proto_data = priv->proto_data;
 
@@ -605,7 +586,6 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw,
             }
         }
     }
-#endif
 }
 
 /**
@@ -764,7 +744,6 @@ EventDevOnly(const struct dirent *dir)
     return strncmp(EVENT_DEV_NAME, dir->d_name, 5) == 0;
 }
 
-#ifdef HAVE_MULTITOUCH
 static void
 event_query_touch(InputInfoPtr pInfo)
 {
@@ -882,7 +861,6 @@ event_query_touch(InputInfoPtr pInfo)
  out:
     mtdev_close(mtdev);
 }
-#endif
 
 /**
  * Probe the open device for dimensions.
@@ -892,25 +870,17 @@ EventReadDevDimensions(InputInfoPtr pInfo)
 {
     SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
     struct eventcomm_proto_data *proto_data = priv->proto_data;
-
-#ifdef HAVE_MULTITOUCH
     int i;
-#endif
 
     proto_data = EventProtoDataAlloc();
     priv->proto_data = proto_data;
 
-#ifdef HAVE_MULTITOUCH
     for (i = 0; i < MT_ABS_SIZE; i++)
         proto_data->axis_map[i] = -1;
     proto_data->cur_slot = -1;
-#endif
 
-    if (event_query_is_touchpad
-        (pInfo->fd, (proto_data) ? proto_data->need_grab : TRUE)) {
-#ifdef HAVE_MULTITOUCH
+    if (event_query_is_touchpad(pInfo->fd, (proto_data) ? proto_data->need_grab : TRUE)) {
         event_query_touch(pInfo);
-#endif
         event_query_axis_ranges(pInfo);
     }
     event_query_model(pInfo->fd, &priv->model, &priv->id_vendor,
diff --git a/src/properties.c b/src/properties.c
index f22feef..49eb6c0 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -474,18 +474,14 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
         dist = (INT32 *) prop->data;
         if (para->scroll_dist_vert != dist[0]) {
             para->scroll_dist_vert = dist[0];
-#ifdef HAVE_SMOOTH_SCROLL
             SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL,
                               para->scroll_dist_vert, 0);
-#endif
         }
         if (para->scroll_dist_horiz != dist[1]) {
             para->scroll_dist_horiz = dist[1];
-#ifdef HAVE_SMOOTH_SCROLL
             SetScrollValuator(dev, priv->scroll_axis_horiz,
                               SCROLL_TYPE_HORIZONTAL, para->scroll_dist_horiz,
                               0);
-#endif
         }
     }
     else if (property == prop_scrolledge) {
diff --git a/src/synaptics.c b/src/synaptics.c
index c35147e..cb0467b 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -124,12 +124,7 @@ typedef enum {
 /*****************************************************************************
  * Forward declaration
  ****************************************************************************/
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
 static int SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
-#else
-static InputInfoPtr SynapticsPreInit(InputDriverPtr drv, IDevPtr dev,
-                                     int flags);
-#endif
 static void SynapticsUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
 static Bool DeviceControl(DeviceIntPtr, int);
 static void ReadInput(InputInfoPtr);
@@ -357,16 +352,12 @@ set_percent_option(pointer options, const char *optname,
                    const int range, const int offset, const int default_value)
 {
     int result;
-
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11
     double percent = xf86CheckPercentOption(options, optname, -1);
 
     if (percent >= 0.0) {
         percent = xf86SetPercentOption(options, optname, -1);
         result = percent / 100.0 * range + offset;
-    }
-    else
-#endif
+    } else
         result = xf86SetIntOption(options, optname, default_value);
 
     return result;
@@ -720,21 +711,11 @@ set_default_parameters(InputInfoPtr pInfo)
     set_softbutton_areas_option(pInfo);
 }
 
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 14
 static double
 SynapticsAccelerationProfile(DeviceIntPtr dev,
                              DeviceVelocityPtr vel,
                              double velocity, double thr, double acc)
 {
-#else
-static float
-SynapticsAccelerationProfile(DeviceIntPtr dev,
-                             DeviceVelocityPtr vel,
-                             float velocity_f, float thr_f, float acc_f)
-{
-    double velocity = velocity_f;
-    double acc = acc_f;
-#endif
     InputInfoPtr pInfo = dev->public.devicePrivate;
     SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private);
     SynapticsParameters *para = &priv->synpara;
@@ -779,49 +760,8 @@ SynapticsAccelerationProfile(DeviceIntPtr dev,
     return accelfct;
 }
 
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
-static int
- NewSynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
-
-/*
- *  called by the module loader for initialization
- */
-static InputInfoPtr
-SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
-{
-    InputInfoPtr pInfo;
-
-    /* Allocate a new InputInfoRec and add it to the head xf86InputDevs. */
-    pInfo = xf86AllocateInput(drv, 0);
-    if (!pInfo) {
-        return NULL;
-    }
-
-    /* initialize the InputInfoRec */
-    pInfo->name = dev->identifier;
-    pInfo->reverse_conversion_proc = NULL;
-    pInfo->dev = NULL;
-    pInfo->private_flags = 0;
-    pInfo->flags = XI86_SEND_DRAG_EVENTS;
-    pInfo->conf_idev = dev;
-    pInfo->always_core_feedback = 0;
-
-    xf86CollectInputOptions(pInfo, NULL, NULL);
-
-    if (NewSynapticsPreInit(drv, pInfo, flags) != Success)
-        return NULL;
-
-    pInfo->flags |= XI86_CONFIGURED;
-
-    return pInfo;
-}
-
-static int
-NewSynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
-#else
 static int
 SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
-#endif
 {
     SynapticsPrivate *priv;
 
@@ -925,14 +865,10 @@ SynapticsUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
         free(priv->timer);
     if (priv && priv->proto_data)
         free(priv->proto_data);
-#ifdef HAVE_SMOOTH_SCROLL
     if (priv && priv->scroll_events_mask)
         valuator_mask_free(&priv->scroll_events_mask);
-#endif
-#ifdef HAVE_MULTITOUCH
     if (priv && priv->open_slots)
         free(priv->open_slots);
-#endif
     free(pInfo->private);
     pInfo->private = NULL;
     xf86DeleteInput(pInfo, 0);
@@ -1093,19 +1029,15 @@ DeviceClose(DeviceIntPtr dev)
 static void
 InitAxesLabels(Atom *labels, int nlabels, const SynapticsPrivate * priv)
 {
-#ifdef HAVE_MULTITOUCH
     int i;
-#endif
 
     memset(labels, 0, nlabels * sizeof(Atom));
     switch (nlabels) {
     default:
-#ifdef HAVE_SMOOTH_SCROLL
     case 4:
         labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_VSCROLL);
     case 3:
         labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HSCROLL);
-#endif
     case 2:
         labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
     case 1:
@@ -1113,14 +1045,12 @@ InitAxesLabels(Atom *labels, int nlabels, const SynapticsPrivate * priv)
         break;
     }
 
-#ifdef HAVE_MULTITOUCH
     for (i = 0; i < priv->num_mt_axes; i++) {
         SynapticsTouchAxisRec *axis = &priv->touch_axes[i];
         int axnum = nlabels - priv->num_mt_axes + i;
 
         labels[axnum] = XIGetKnownProperty(axis->label);
     }
-#endif
 }
 
 static void
@@ -1150,7 +1080,6 @@ InitButtonLabels(Atom *labels, int nlabels)
 static void
 DeviceInitTouch(DeviceIntPtr dev, Atom *axes_labels)
 {
-#ifdef HAVE_MULTITOUCH
     InputInfoPtr pInfo = dev->public.devicePrivate;
     SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private);
     int i;
@@ -1197,7 +1126,6 @@ DeviceInitTouch(DeviceIntPtr dev, Atom *axes_labels)
             xf86InitValuatorDefaults(dev, axnum);
         }
     }
-#endif
 }
 
 static Bool
@@ -1215,13 +1143,9 @@ DeviceInit(DeviceIntPtr dev)
     Atom *axes_labels;
     DeviceVelocityPtr pVel;
 
-#ifdef HAVE_SMOOTH_SCROLL
     num_axes += 2;
-#endif
 
-#ifdef HAVE_MULTITOUCH
     num_axes += priv->num_mt_axes;
-#endif
 
     axes_labels = calloc(num_axes, sizeof(Atom));
     if (!axes_labels) {
@@ -1297,12 +1221,9 @@ DeviceInit(DeviceIntPtr dev)
         max = -1;
     }
 
-    xf86InitValuatorAxisStruct(dev, 0, axes_labels[0],
-                               min, max, priv->resx * 1000, 0, priv->resx * 1000
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
-                               , Relative
-#endif
-        );
+    xf86InitValuatorAxisStruct(dev, 0, axes_labels[0], min, max,
+			       priv->resx * 1000, 0, priv->resx * 1000,
+			       Relative);
     xf86InitValuatorDefaults(dev, 0);
 
     /* Y valuator */
@@ -1315,15 +1236,11 @@ DeviceInit(DeviceIntPtr dev)
         max = -1;
     }
 
-    xf86InitValuatorAxisStruct(dev, 1, axes_labels[1],
-                               min, max, priv->resy * 1000, 0, priv->resy * 1000
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
-                               , Relative
-#endif
-        );
+    xf86InitValuatorAxisStruct(dev, 1, axes_labels[1], min, max,
+			       priv->resy * 1000, 0, priv->resy * 1000,
+			       Relative);
     xf86InitValuatorDefaults(dev, 1);
 
-#ifdef HAVE_SMOOTH_SCROLL
     xf86InitValuatorAxisStruct(dev, 2, axes_labels[2], 0, -1, 0, 0, 0,
                                Relative);
     priv->scroll_axis_horiz = 2;
@@ -1340,7 +1257,6 @@ DeviceInit(DeviceIntPtr dev)
                       priv->synpara.scroll_dist_horiz, 0);
     SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL,
                       priv->synpara.scroll_dist_vert, 0);
-#endif
 
     DeviceInitTouch(dev, axes_labels);
 
@@ -1368,9 +1284,7 @@ DeviceInit(DeviceIntPtr dev)
  fail:
     free(priv->local_hw_state);
     free(priv->hwState);
-#ifdef HAVE_MULTITOUCH
     free(priv->open_slots);
-#endif
     return !Success;
 }
 
@@ -2521,8 +2435,6 @@ clickpad_guess_clickfingers(SynapticsPrivate * priv,
                             struct SynapticsHwState *hw)
 {
     int nfingers = 0;
-
-#if HAVE_MULTITOUCH
     char close_point[SYNAPTICS_MAX_TOUCHES] = { 0 };    /* 1 for each point close
                                                            to another one */
     int i, j;
@@ -2566,7 +2478,6 @@ clickpad_guess_clickfingers(SynapticsPrivate * priv,
 
     for (i = 0; i < SYNAPTICS_MAX_TOUCHES; i++)
         nfingers += close_point[i];
-#endif
 
     return nfingers;
 }
@@ -2667,7 +2578,6 @@ post_scroll_events(const InputInfoPtr pInfo)
 {
     SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private);
 
-#ifdef HAVE_SMOOTH_SCROLL
     valuator_mask_zero(priv->scroll_events_mask);
 
     if (priv->scroll.delta_y != 0.0) {
@@ -2682,38 +2592,12 @@ post_scroll_events(const InputInfoPtr pInfo)
     }
     if (valuator_mask_num_valuators(priv->scroll_events_mask))
         xf86PostMotionEventM(pInfo->dev, FALSE, priv->scroll_events_mask);
-#else
-    SynapticsParameters *para = &priv->synpara;
-
-    /* smooth scrolling uses the dist as increment */
-
-    while (priv->scroll.delta_y <= -para->scroll_dist_vert) {
-        post_button_click(pInfo, 4);
-        priv->scroll.delta_y += para->scroll_dist_vert;
-    }
-
-    while (priv->scroll.delta_y >= para->scroll_dist_vert) {
-        post_button_click(pInfo, 5);
-        priv->scroll.delta_y -= para->scroll_dist_vert;
-    }
-
-    while (priv->scroll.delta_x <= -para->scroll_dist_horiz) {
-        post_button_click(pInfo, 6);
-        priv->scroll.delta_x += para->scroll_dist_horiz;
-    }
-
-    while (priv->scroll.delta_x >= para->scroll_dist_horiz) {
-        post_button_click(pInfo, 7);
-        priv->scroll.delta_x -= para->scroll_dist_horiz;
-    }
-#endif
 }
 
 /* Update the open slots and number of active touches */
 static void
 UpdateTouchState(InputInfoPtr pInfo, struct SynapticsHwState *hw)
 {
-#ifdef HAVE_MULTITOUCH
     SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
     int i;
 
@@ -2739,13 +2623,11 @@ UpdateTouchState(InputInfoPtr pInfo, struct SynapticsHwState *hw)
     }
 
     SynapticsResetTouchHwState(hw, FALSE);
-#endif
 }
 
 static void
 HandleTouches(InputInfoPtr pInfo, struct SynapticsHwState *hw)
 {
-#ifdef HAVE_MULTITOUCH
     SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
     SynapticsParameters *para = &priv->synpara;
     int new_active_touches = priv->num_active_touches;
@@ -2822,7 +2704,6 @@ HandleTouches(InputInfoPtr pInfo, struct SynapticsHwState *hw)
 
  out:
     UpdateTouchState(pInfo, hw);
-#endif
 }
 
 static void
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 7024a9b..3a1fd3d 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -36,10 +36,6 @@
 #define DBG(verb, msg, ...)     /* */
 #endif
 
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
-#define xf86IDrvMsg(pInfo, type, ...) xf86Msg(type, __VA_ARGS__)
-#endif
-
 #ifdef AXIS_LABEL_PROP_REL_VSCROLL
 #define HAVE_SMOOTH_SCROLL
 #endif
@@ -249,13 +245,10 @@ struct _SynapticsPrivateRec {
     unsigned short id_vendor;   /* vendor id */
     unsigned short id_product;  /* product id */
 
-#ifdef HAVE_SMOOTH_SCROLL
     int scroll_axis_horiz;      /* Horizontal smooth-scrolling axis */
     int scroll_axis_vert;       /* Vertical smooth-scrolling axis */
     ValuatorMask *scroll_events_mask;   /* ValuatorMask for smooth-scrolling */
-#endif
 
-#ifdef HAVE_MULTITOUCH
     Bool has_touch;             /* Device has multitouch capabilities */
     int max_touches;            /* Number of touches supported */
     int num_mt_axes;            /* Number of multitouch axes other than X, Y */
@@ -263,7 +256,6 @@ struct _SynapticsPrivateRec {
     int num_slots;              /* Number of touch slots allocated */
     int *open_slots;            /* Array of currently open touch slots */
     int num_active_touches;     /* Number of active touches on device */
-#endif
 };
 
 #endif                          /* _SYNAPTICSSTR_H_ */
diff --git a/src/synproto.c b/src/synproto.c
index d6e8c65..adec615 100644
--- a/src/synproto.c
+++ b/src/synproto.c
@@ -25,7 +25,6 @@
 #include "synaptics.h"
 #include "synapticsstr.h"
 
-#ifdef HAVE_MULTITOUCH
 static int
 HwStateAllocTouch(struct SynapticsHwState *hw, SynapticsPrivate * priv)
 {
@@ -60,7 +59,6 @@ HwStateAllocTouch(struct SynapticsHwState *hw, SynapticsPrivate * priv)
     hw->mt_mask = NULL;
     return BadAlloc;
 }
-#endif
 
 struct SynapticsHwState *
 SynapticsHwStateAlloc(SynapticsPrivate * priv)
@@ -71,12 +69,10 @@ SynapticsHwStateAlloc(SynapticsPrivate * priv)
     if (!hw)
         return NULL;
 
-#ifdef HAVE_MULTITOUCH
     if (HwStateAllocTouch(hw, priv) != Success) {
         free(hw);
         return NULL;
     }
-#endif
 
     return hw;
 }
@@ -84,7 +80,6 @@ SynapticsHwStateAlloc(SynapticsPrivate * priv)
 void
 SynapticsHwStateFree(struct SynapticsHwState **hw)
 {
-#ifdef HAVE_MULTITOUCH
     int i;
 
     if (!*hw)
@@ -94,7 +89,6 @@ SynapticsHwStateFree(struct SynapticsHwState **hw)
     for (i = 0; i < (*hw)->num_mt_mask; i++)
         valuator_mask_free(&(*hw)->mt_mask[i]);
     free((*hw)->mt_mask);
-#endif
 
     free(*hw);
     *hw = NULL;
@@ -104,9 +98,7 @@ void
 SynapticsCopyHwState(struct SynapticsHwState *dst,
                      const struct SynapticsHwState *src)
 {
-#ifdef HAVE_MULTITOUCH
     int i;
-#endif
 
     dst->millis = src->millis;
     dst->x = src->x;
@@ -122,12 +114,10 @@ SynapticsCopyHwState(struct SynapticsHwState *dst,
     dst->down = src->down;
     memcpy(dst->multi, src->multi, sizeof(dst->multi));
     dst->middle = src->middle & BTN_EMULATED_FLAG ? 0 : src->middle;
-#ifdef HAVE_MULTITOUCH
     for (i = 0; i < dst->num_mt_mask && i < src->num_mt_mask; i++)
         valuator_mask_copy(dst->mt_mask[i], src->mt_mask[i]);
     memcpy(dst->slot_state, src->slot_state,
            dst->num_mt_mask * sizeof(enum SynapticsSlotState));
-#endif
 }
 
 void
@@ -156,7 +146,6 @@ SynapticsResetHwState(struct SynapticsHwState *hw)
 void
 SynapticsResetTouchHwState(struct SynapticsHwState *hw, Bool set_slot_empty)
 {
-#ifdef HAVE_MULTITOUCH
     int i;
 
     for (i = 0; i < hw->num_mt_mask; i++) {
@@ -179,5 +168,4 @@ SynapticsResetTouchHwState(struct SynapticsHwState *hw, Bool set_slot_empty)
             break;
         }
     }
-#endif
 }
diff --git a/src/synproto.h b/src/synproto.h
index a099fce..7c648b6 100644
--- a/src/synproto.h
+++ b/src/synproto.h
@@ -69,11 +69,9 @@ struct SynapticsHwState {
     Bool multi[8];
     Bool middle;                /* Some ALPS touchpads have a middle button */
 
-#ifdef HAVE_MULTITOUCH
     int num_mt_mask;
     ValuatorMask **mt_mask;
     enum SynapticsSlotState *slot_state;
-#endif
 };
 
 struct CommData {
diff --git a/test/fake-symbols.c b/test/fake-symbols.c
index 6f55c7b..173e1af 100644
--- a/test/fake-symbols.c
+++ b/test/fake-symbols.c
@@ -1,7 +1,6 @@
 #include "fake-symbols.h"
 
-_X_EXPORT
-    int
+_X_EXPORT int
 xf86ReadSerial(int fd, void *buf, int count)
 {
     return 0;
@@ -26,7 +25,7 @@ xf86WaitForInput(int fd, int timeout)
 }
 
 _X_EXPORT int
-xf86OpenSerial(OPTTYPE options)
+xf86OpenSerial(XF86OptionPtr options)
 {
     return 0;
 }
@@ -37,44 +36,44 @@ xf86SetSerialSpeed(int fd, int speed)
     return 0;
 }
 
-_X_EXPORT OPTTYPE
-xf86ReplaceIntOption(OPTTYPE optlist, const char *name, const int val)
+_X_EXPORT XF86OptionPtr
+xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val)
 {
     return NULL;
 }
 
 _X_EXPORT char *
-xf86SetStrOption(OPTTYPE optlist, const char *name, CONST char *deflt)
+xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt)
 {
     return NULL;
 }
 
 _X_EXPORT int
-xf86SetBoolOption(OPTTYPE optlist, const char *name, int deflt)
+xf86SetBoolOption(XF86OptionPtr optlist, const char *name, int deflt)
 {
     return 0;
 }
 
-_X_EXPORT OPTTYPE
-xf86AddNewOption(OPTTYPE head, const char *name, const char *val)
+_X_EXPORT XF86OptionPtr
+xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val)
 {
     return NULL;
 }
 
-_X_EXPORT CONST char *
-xf86FindOptionValue(OPTTYPE options, const char *name)
+_X_EXPORT const char *
+xf86FindOptionValue(XF86OptionPtr options, const char *name)
 {
     return NULL;
 }
 
 _X_EXPORT char *
-xf86OptionName(OPTTYPE opt)
+xf86OptionName(XF86OptionPtr opt)
 {
     return NULL;
 }
 
 _X_EXPORT char *
-xf86OptionValue(OPTTYPE opt)
+xf86OptionValue(XF86OptionPtr opt)
 {
     return NULL;
 }
@@ -86,7 +85,7 @@ xf86NameCmp(const char *s1, const char *s2)
 }
 
 _X_EXPORT char *
-xf86CheckStrOption(OPTTYPE optlist, const char *name, char *deflt)
+xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
 {
     return NULL;
 }
@@ -144,13 +143,11 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
     return;
 }
 
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11
 _X_EXPORT void
 FreeInputAttributes(InputAttributes * attrs)
 {
     return;
 }
-#endif
 
 _X_EXPORT void
 xf86PostButtonEvent(DeviceIntPtr device,
@@ -185,8 +182,8 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
     return;
 }
 
-_X_EXPORT OPTTYPE
-xf86OptionListDuplicate(OPTTYPE options)
+_X_EXPORT XF86OptionPtr
+xf86OptionListDuplicate(XF86OptionPtr options)
 {
     return NULL;
 }
@@ -213,7 +210,7 @@ xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code, int is_down)
 }
 
 _X_EXPORT int
-xf86SetIntOption(OPTTYPE optlist, const char *name, int deflt)
+xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt)
 {
     return 0;
 }
@@ -223,10 +220,7 @@ xf86PostButtonEventP(DeviceIntPtr device,
                      int is_absolute,
                      int button,
                      int is_down, int first_valuator, int num_valuators,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
-                     const
-#endif
-                     int *valuators)
+                     const int *valuators)
 {
     return;
 }
@@ -240,7 +234,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
 _X_EXPORT int
 XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
                        int format, int mode, unsigned long len,
-                       OPTTYPE value, Bool sendevent)
+                       XF86OptionPtr value, Bool sendevent)
 {
     return 0;
 }
@@ -253,9 +247,7 @@ GetTimeInMillis(void)
 
 _X_EXPORT int
 NewInputDeviceRequest(InputOption *options,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11
                       InputAttributes * attrs,
-#endif
                       DeviceIntPtr *pdev)
 {
     return 0;
@@ -267,13 +259,11 @@ InitLedFeedbackClassDeviceStruct(DeviceIntPtr dev, LedCtrlProcPtr controlProc)
     return FALSE;
 }
 
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11
 _X_EXPORT InputAttributes *
 DuplicateInputAttributes(InputAttributes * attrs)
 {
     return NULL;
 }
-#endif
 
 _X_EXPORT int
 ValidAtom(Atom atom)
@@ -329,10 +319,7 @@ xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format, ...)
 _X_EXPORT void
 xf86PostMotionEventP(DeviceIntPtr device,
                      int is_absolute, int first_valuator, int num_valuators,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
-                     const
-#endif
-                     int *valuators)
+                     const int *valuators)
 {
     return;
 }
@@ -344,14 +331,14 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
     return FALSE;
 }
 
-_X_EXPORT OPTTYPE
-xf86ReplaceStrOption(OPTTYPE optlist, const char *name, const char *val)
+_X_EXPORT XF86OptionPtr
+xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char *val)
 {
     return NULL;
 }
 
-_X_EXPORT OPTTYPE
-xf86NextOption(OPTTYPE list)
+_X_EXPORT XF86OptionPtr
+xf86NextOption(XF86OptionPtr list)
 {
     return NULL;
 }
@@ -377,10 +364,7 @@ GetMotionHistorySize(void)
 _X_EXPORT void
 xf86PostProximityEventP(DeviceIntPtr device,
                         int is_in, int first_valuator, int num_valuators,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
-                        const
-#endif
-                        int *valuators)
+                        const int *valuators)
 {
     return;
 }
@@ -391,26 +375,23 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev)
     return FALSE;
 }
 
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
 void
-xf86ProcessCommonOptions(InputInfoPtr pInfo, OPTTYPE list)
+xf86ProcessCommonOptions(InputInfoPtr pInfo, XF86OptionPtr list)
 {
 }
 
 void
 xf86CollectInputOptions(InputInfoPtr pInfo,
-                        const char **defaultOpts, OPTTYPE extraOpts)
+                        const char **defaultOpts)
 {
 }
 
 InputInfoPtr
-xf86AllocateInput(InputDriverPtr drv, int flags)
+xf86AllocateInput(void)
 {
     return NULL;
 }
 
-#endif
-
 ClientPtr serverClient;
 
 Bool
@@ -421,7 +402,6 @@ QueueWorkProc(Bool (*function)
     return FALSE;
 }
 
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
 _X_EXPORT ValuatorMask *
 valuator_mask_new(int num_valuators)
 {
@@ -464,12 +444,9 @@ _X_EXPORT void
 valuator_mask_copy(ValuatorMask *dest, const ValuatorMask *src)
 {
 }
-#endif
 
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
 _X_EXPORT void
 xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid,
                    uint16_t type, uint32_t flags, const ValuatorMask *mask)
 {
 }
-#endif
diff --git a/test/fake-symbols.h b/test/fake-symbols.h
index 70049d0..76d8e63 100644
--- a/test/fake-symbols.h
+++ b/test/fake-symbols.h
@@ -1,40 +1,32 @@
 #include <xorg-server.h>
 #include <xf86Xinput.h>
 
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 14
-#define OPTTYPE XF86OptionPtr
-#define CONST const
-#else
-#define OPTTYPE pointer
-#define CONST
-#endif
-
 extern int xf86ReadSerial(int fd, void *buf, int count);
 extern int xf86WriteSerial(int fd, const void *buf, int count);
 extern int xf86CloseSerial(int fd);
 extern int xf86WaitForInput(int fd, int timeout);
-extern int xf86OpenSerial(OPTTYPE options);
+extern int xf86OpenSerial(XF86OptionPtr options);
 extern int xf86SetSerialSpeed(int fd, int speed);
 
-extern OPTTYPE xf86ReplaceIntOption(OPTTYPE optlist, const char *name,
+extern XF86OptionPtr xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name,
                                     const int val);
-extern OPTTYPE xf86AddNewOption(OPTTYPE head, const char *name,
+extern XF86OptionPtr xf86AddNewOption(XF86OptionPtr head, const char *name,
                                 const char *val);
-extern char *xf86OptionName(OPTTYPE opt);
-extern CONST char *xf86FindOptionValue(OPTTYPE options, const char *name);
+extern char *xf86OptionName(XF86OptionPtr opt);
+extern const char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
 extern int xf86NameCmp(const char *s1, const char *s2);
-extern char *xf86CheckStrOption(OPTTYPE optlist, const char *name, char *deflt);
+extern char *xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt);
 
-extern char *xf86SetStrOption(OPTTYPE optlist, const char *name,
-                              CONST char *deflt);
-extern int xf86SetBoolOption(OPTTYPE optlist, const char *name, int deflt);
-extern OPTTYPE xf86AddNewOption(OPTTYPE head, const char *name,
+extern char *xf86SetStrOption(XF86OptionPtr optlist, const char *name,
+                              const char *deflt);
+extern int xf86SetBoolOption(XF86OptionPtr optlist, const char *name, int deflt);
+extern XF86OptionPtr xf86AddNewOption(XF86OptionPtr head, const char *name,
                                 const char *val);
-extern CONST char *xf86FindOptionValue(OPTTYPE options, const char *name);
-extern char *xf86OptionName(OPTTYPE opt);
-extern char *xf86OptionValue(OPTTYPE opt);
+extern const char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
+extern char *xf86OptionName(XF86OptionPtr opt);
+extern char *xf86OptionValue(XF86OptionPtr opt);
 extern int xf86NameCmp(const char *s1, const char *s2);
-extern char *xf86CheckStrOption(OPTTYPE optlist, const char *name, char *deflt);
+extern char *xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt);
 extern void xf86AddEnabledDevice(InputInfoPtr pInfo);
 extern void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
 extern Atom XIGetKnownProperty(char *name);
@@ -44,10 +36,7 @@ extern int
  xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min);
 
 extern void DeleteInputDeviceRequest(DeviceIntPtr pDev);
-
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11
 extern void FreeInputAttributes(InputAttributes * attrs);
-#endif
 extern void
 
 xf86PostButtonEvent(DeviceIntPtr device,
@@ -60,7 +49,7 @@ extern int
 
 extern InputInfoPtr xf86FirstLocalDevice(void);
 extern void xf86DeleteInput(InputInfoPtr pInp, int flags);
-extern OPTTYPE xf86OptionListDuplicate(OPTTYPE options);
+extern XF86OptionPtr xf86OptionListDuplicate(XF86OptionPtr options);
 extern Bool
 
 InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom *labels,
@@ -73,17 +62,14 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
 extern void
  xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code, int is_down);
 extern int
- xf86SetIntOption(OPTTYPE optlist, const char *name, int deflt);
+ xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt);
 extern void
 
 xf86PostButtonEventP(DeviceIntPtr device,
                      int is_absolute,
                      int button,
                      int is_down, int first_valuator, int num_valuators,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
-                     const
-#endif
-                     int *valuators);
+                     const int *valuators);
 extern Bool
  InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc);
 
@@ -91,22 +77,18 @@ extern int
 
 XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
                        int format, int mode, unsigned long len,
-                       OPTTYPE value, Bool sendevent);
+                       XF86OptionPtr value, Bool sendevent);
 extern CARD32 GetTimeInMillis(void);
 
 extern int
  NewInputDeviceRequest(InputOption *options,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11
                        InputAttributes * attrs,
-#endif
                        DeviceIntPtr *pdev);
 
 extern Bool
  InitLedFeedbackClassDeviceStruct(DeviceIntPtr dev, LedCtrlProcPtr controlProc);
 
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11
 extern InputAttributes *DuplicateInputAttributes(InputAttributes * attrs);
-#endif
 extern int ValidAtom(Atom atom);
 extern Bool
 
@@ -130,23 +112,19 @@ extern void xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format,
                         ...);
 
 extern void
-
 xf86PostMotionEventP(DeviceIntPtr device,
                      int is_absolute, int first_valuator, int num_valuators,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
-                     const
-#endif
-                     int *valuators);
+                     const int *valuators);
 
 extern Bool
 
 InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
                               int numMotionEvents, int mode);
 
-extern OPTTYPE
-xf86ReplaceStrOption(OPTTYPE optlist, const char *name, const char *val);
+extern XF86OptionPtr
+xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char *val);
 
-extern OPTTYPE xf86NextOption(OPTTYPE list);
+extern XF86OptionPtr xf86NextOption(XF86OptionPtr list);
 
 extern int
 
@@ -157,26 +135,20 @@ extern Atom MakeAtom(const char *string, unsigned len, Bool makeit);
 extern int GetMotionHistorySize(void);
 
 extern void
-
 xf86PostProximityEventP(DeviceIntPtr device,
                         int is_in, int first_valuator, int num_valuators,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
-                        const
-#endif
-                        int *valuators);
+                        const int *valuators);
 
 extern Bool InitFocusClassDeviceStruct(DeviceIntPtr dev);
 
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
 extern void
- xf86ProcessCommonOptions(InputInfoPtr pInfo, OPTTYPE list);
+ xf86ProcessCommonOptions(InputInfoPtr pInfo, XF86OptionPtr list);
 
 extern void
-
 xf86CollectInputOptions(InputInfoPtr pInfo,
-                        const char **defaultOpts, OPTTYPE extraOpts);
+                        const char **defaultOpts);
 
-extern InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
+extern InputInfoPtr xf86AllocateInput(void);
 
 extern ClientPtr serverClient;
 
@@ -184,4 +156,3 @@ extern Bool
 QueueWorkProc(Bool (*function)
               (ClientPtr /* pClient */ , pointer /* closure */ ),
               ClientPtr client, pointer closure);
-#endif
-- 
1.7.10.1



More information about the xorg-devel mailing list