diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-03-10 09:07:59 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-04-30 12:53:59 +1000 |
commit | 1e08fbf8a71b5958ac1765c889b5101e62fad20f (patch) | |
tree | c83d2205f5eadf137fe5b348ac42e78258de93b7 | |
parent | eb3af31c597ed6dc1bef31f39a5f6c9d586713ae (diff) |
Add property support for secondary (top) software buttons
This was originally intended as a fixed xorg.conf option only (and still
largely is seen as such). Secondary software button are required only on a specific series
of touchpads and should be pre-configured by the system and/or the
distribution. As such, the property will not be initialized if it is not set
in the xorg.conf and will thus not respond to runtime changes.
Exposing the property in this way gives clients a chance of detecting if a top
software button area is present and thus adjust their behaviour accordingly.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 66240dc329683f0141c1e11590ea2c3d8ca25788)
-rw-r--r-- | include/synaptics-properties.h | 3 | ||||
-rw-r--r-- | man/synaptics.man | 3 | ||||
-rw-r--r-- | src/properties.c | 48 | ||||
-rw-r--r-- | src/synaptics.c | 16 | ||||
-rw-r--r-- | src/synapticsstr.h | 16 |
5 files changed, 59 insertions, 27 deletions
diff --git a/include/synaptics-properties.h b/include/synaptics-properties.h index 19bd2b2..32ab2e1 100644 --- a/include/synaptics-properties.h +++ b/include/synaptics-properties.h @@ -152,6 +152,9 @@ /* 32 bit, 4 values, left, right, top, buttom */ #define SYNAPTICS_PROP_SOFTBUTTON_AREAS "Synaptics Soft Button Areas" +/* 32 bit, 4 values, left, right, top, buttom */ +#define SYNAPTICS_PROP_SECONDARY_SOFTBUTTON_AREAS "Synaptics Secondary Soft Button Areas" + /* 32 Bit Integer, 2 values, horizontal hysteresis, vertical hysteresis */ #define SYNAPTICS_PROP_NOISE_CANCELLATION "Synaptics Noise Cancellation" diff --git a/man/synaptics.man b/man/synaptics.man index b99fd5c..e42f647 100644 --- a/man/synaptics.man +++ b/man/synaptics.man @@ -498,7 +498,8 @@ For the allowed values for this option, see .B Option \*qSoftButtonAreas\*q. Primary and secondary soft button areas must not overlap each other. If they do, the behavior of the driver is undefined. -No property associated, this option must be set in the +Property: "Synaptics Secondary Soft Button Areas". This property is only +initialized if the option is set in the __xconfigfile__(__filemansuffix__). . diff --git a/src/properties.c b/src/properties.c index 886d8c2..4c75797 100644 --- a/src/properties.c +++ b/src/properties.c @@ -91,6 +91,7 @@ Atom prop_capabilities = 0; Atom prop_resolution = 0; Atom prop_area = 0; Atom prop_softbutton_areas = 0; +Atom prop_secondary_softbutton_areas = 0; Atom prop_noise_cancellation = 0; Atom prop_product_id = 0; Atom prop_device_node = 0; @@ -164,16 +165,30 @@ InitSoftButtonProperty(InputInfoPtr pInfo) SynapticsParameters *para = &priv->synpara; int values[8]; - values[0] = para->softbutton_areas[0][0]; - values[1] = para->softbutton_areas[0][1]; - values[2] = para->softbutton_areas[0][2]; - values[3] = para->softbutton_areas[0][3]; - values[4] = para->softbutton_areas[1][0]; - values[5] = para->softbutton_areas[1][1]; - values[6] = para->softbutton_areas[1][2]; - values[7] = para->softbutton_areas[1][3]; + values[0] = para->softbutton_areas[BOTTOM_RIGHT_BUTTON_AREA][LEFT]; + values[1] = para->softbutton_areas[BOTTOM_RIGHT_BUTTON_AREA][RIGHT]; + values[2] = para->softbutton_areas[BOTTOM_RIGHT_BUTTON_AREA][TOP]; + values[3] = para->softbutton_areas[BOTTOM_RIGHT_BUTTON_AREA][BOTTOM]; + values[4] = para->softbutton_areas[BOTTOM_MIDDLE_BUTTON_AREA][LEFT]; + values[5] = para->softbutton_areas[BOTTOM_MIDDLE_BUTTON_AREA][RIGHT]; + values[6] = para->softbutton_areas[BOTTOM_MIDDLE_BUTTON_AREA][TOP]; + values[7] = para->softbutton_areas[BOTTOM_MIDDLE_BUTTON_AREA][BOTTOM]; prop_softbutton_areas = InitAtom(pInfo->dev, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 8, values); + + values[0] = para->softbutton_areas[TOP_RIGHT_BUTTON_AREA][LEFT]; + values[1] = para->softbutton_areas[TOP_RIGHT_BUTTON_AREA][RIGHT]; + values[2] = para->softbutton_areas[TOP_RIGHT_BUTTON_AREA][TOP]; + values[3] = para->softbutton_areas[TOP_RIGHT_BUTTON_AREA][BOTTOM]; + values[4] = para->softbutton_areas[TOP_MIDDLE_BUTTON_AREA][LEFT]; + values[5] = para->softbutton_areas[TOP_MIDDLE_BUTTON_AREA][RIGHT]; + values[6] = para->softbutton_areas[TOP_MIDDLE_BUTTON_AREA][TOP]; + values[7] = para->softbutton_areas[TOP_MIDDLE_BUTTON_AREA][BOTTOM]; + + if (values[0] || values[1] || values[2] || values[4] || + values[5] || values[6] || values[7]) + prop_secondary_softbutton_areas = + InitAtom(pInfo->dev, SYNAPTICS_PROP_SECONDARY_SOFTBUTTON_AREAS, 32, 8, values); } void @@ -768,8 +783,21 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, if (!SynapticsIsSoftButtonAreasValid(areas)) return BadValue; - memcpy(para->softbutton_areas[0], areas, 4 * sizeof(int)); - memcpy(para->softbutton_areas[1], areas + 4, 4 * sizeof(int)); + memcpy(para->softbutton_areas[BOTTOM_RIGHT_BUTTON_AREA], areas, 4 * sizeof(int)); + memcpy(para->softbutton_areas[BOTTOM_MIDDLE_BUTTON_AREA], areas + 4, 4 * sizeof(int)); + } + else if (property == prop_secondary_softbutton_areas) { + int *areas; + + if (prop->size != 8 || prop->format != 32 || prop->type != XA_INTEGER) + return BadMatch; + + areas = (int *) prop->data; + if (!SynapticsIsSoftButtonAreasValid(areas)) + return BadValue; + + memcpy(para->softbutton_areas[TOP_RIGHT_BUTTON_AREA], areas, 4 * sizeof(int)); + memcpy(para->softbutton_areas[TOP_MIDDLE_BUTTON_AREA], areas + 4, 4 * sizeof(int)); } else if (property == prop_noise_cancellation) { INT32 *hyst; diff --git a/src/synaptics.c b/src/synaptics.c index a8abdb2..4b74f7c 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -89,22 +89,6 @@ enum EdgeType { LEFT_TOP_EDGE = TOP_EDGE | LEFT_EDGE }; -enum SoftButtonAreas { - BOTTOM_BUTTON_AREA = 0, - BOTTOM_RIGHT_BUTTON_AREA = 0, - BOTTOM_MIDDLE_BUTTON_AREA = 1, - TOP_BUTTON_AREA = 2, - TOP_RIGHT_BUTTON_AREA = 2, - TOP_MIDDLE_BUTTON_AREA = 3 -}; - -enum SoftButtonAreaEdges { - LEFT = 0, - RIGHT = 1, - TOP = 2, - BOTTOM = 3 -}; - /* * We expect to be receiving a steady 80 packets/sec (which gives 40 * reports/sec with more than one finger on the pad, as Advanced Gesture Mode diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 894cef0..fe4a8af 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -149,6 +149,22 @@ enum TouchpadModel { MODEL_UNIBODY_MACBOOK }; +enum SoftButtonAreas { + BOTTOM_BUTTON_AREA = 0, + BOTTOM_RIGHT_BUTTON_AREA = 0, + BOTTOM_MIDDLE_BUTTON_AREA = 1, + TOP_BUTTON_AREA = 2, + TOP_RIGHT_BUTTON_AREA = 2, + TOP_MIDDLE_BUTTON_AREA = 3 +}; + +enum SoftButtonAreaEdges { + LEFT = 0, + RIGHT = 1, + TOP = 2, + BOTTOM = 3 +}; + typedef struct _SynapticsParameters { /* Parameter data */ int left_edge, right_edge, top_edge, bottom_edge; /* edge coordinates absolute */ |