diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2009-05-07 18:17:55 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-22 15:14:20 +1000 |
commit | d4c64483f75af56f0b989798adb28487a76d926f (patch) | |
tree | 08dec28246258340e39f7b78bcb43c9b45ac7b7a | |
parent | 3b2c023ca64c20203973fc3e606ab91dfc65c16f (diff) |
Add model-specific edges for appletouch.
Needs around 8.5% to be useable.
I created a table to iterate through the different products rather than
using if/else branches. I can enumerate the appletouch product_ids, but I
suspect they will all be around the same range (hence the PRODUCT_ANY). If
another product id shows different behavior, we can just add an entry to
the table as appropriate.
I also changed the default eheight to be 5.4% to match the spec.
Reported-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
(cherry picked from commit c3ab0ae4f3f04da7018173662ede174c97710c8a)
-rw-r--r-- | src/eventcomm.c | 25 | ||||
-rw-r--r-- | src/synaptics.c | 6 | ||||
-rw-r--r-- | src/synapticsstr.h | 3 |
3 files changed, 27 insertions, 7 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c index 690d179..600fa29 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -115,22 +115,37 @@ event_query_is_touchpad(int fd) return TRUE; } +typedef struct { + short vendor; + short product; + enum TouchpadModel model; +} model_lookup_t; +#define PRODUCT_ANY 0x0000 + +static model_lookup_t model_lookup_table[] = { + {0x0002, 0x0007, MODEL_SYNAPTICS}, + {0x0002, 0x0008, MODEL_ALPS}, + {0x05ac, PRODUCT_ANY, MODEL_APPLETOUCH}, + {0x0, 0x0, 0x0} +}; + static void event_query_info(LocalDevicePtr local) { SynapticsPrivate *priv = (SynapticsPrivate *)local->private; short id[4]; int rc; + model_lookup_t *model_lookup; SYSCALL(rc = ioctl(local->fd, EVIOCGID, id)); if (rc < 0) return; - if (id[ID_VENDOR] == 0x2 && id[ID_PRODUCT] == 0x7) - priv->model = MODEL_SYNAPTICS; - else if (id[ID_VENDOR] == 0x2 && id[ID_PRODUCT] == 0x8) - priv->model = MODEL_ALPS; - + for(model_lookup = model_lookup_table; model_lookup->vendor; model_lookup++) { + if(model_lookup->vendor == id[ID_VENDOR] && + (model_lookup->product == id[ID_PRODUCT] || model_lookup->product == PRODUCT_ANY)) + priv->model = model_lookup->model; + } } /* Query device for axis ranges */ diff --git a/src/synaptics.c b/src/synaptics.c index 710c786..fdd7790 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -341,10 +341,14 @@ static void set_default_parameters(LocalDevicePtr local) { ewidth = width * .15; eheight = height * .15; + } else if (priv->model == MODEL_APPLETOUCH) + { + ewidth = width * .085; + eheight = height * .085; } else { ewidth = width * .04; - eheight = height * .04; + eheight = height * .054; } l = priv->minx + ewidth; diff --git a/src/synapticsstr.h b/src/synapticsstr.h index f518c11..d5a3f91 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -82,7 +82,8 @@ enum TapButtonState { enum TouchpadModel { MODEL_UNKNOWN = 0, MODEL_SYNAPTICS, - MODEL_ALPS + MODEL_ALPS, + MODEL_APPLETOUCH }; typedef struct _SynapticsPrivateRec |