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