From 3430f4af41184752d698dcbf4919469e36b3216c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 23 Mar 2012 16:19:18 +1000 Subject: Require xserver 1.12 and inputproto 2.2 This drops conditional compilation of multitouch support, smooth scrolling support and old ABIs. Signed-off-by: Peter Hutterer Acked-by: Chase Douglas --- src/eventcomm.c | 32 +------------ src/properties.c | 4 -- src/synaptics.c | 133 +++-------------------------------------------------- src/synapticsstr.h | 8 ---- src/synproto.c | 12 ----- src/synproto.h | 2 - 6 files changed, 8 insertions(+), 183 deletions(-) (limited to 'src') 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 -#ifdef HAVE_MULTITOUCH #include -#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 { -- cgit v1.2.3