summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-05-21 15:39:30 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-05-31 14:56:48 +1000
commitf35f83f5d02dd82575dd3052dbfba7048cd6646e (patch)
tree4f60e1b37ab6870e7836e569ada8484b86c1c94f
parentbe7119851d8f61a9bfd00c5869d7419e0655e822 (diff)
Sanitize the scroll API a bit
Don't require valuator masks, just post vert/horiz and whatever the current values of those are. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/synaptics-x11.c15
-rw-r--r--src/synaptics.c22
-rw-r--r--src/synaptics.h2
-rw-r--r--src/synapticsstr.h5
4 files changed, 26 insertions, 18 deletions
diff --git a/src/synaptics-x11.c b/src/synaptics-x11.c
index 3a6d930..d7168af 100644
--- a/src/synaptics-x11.c
+++ b/src/synaptics-x11.c
@@ -818,19 +818,20 @@ void SynapticsMotionEvent(SynapticsPrivate *priv, int x, int y)
xf86PostMotionEvent(pInfo->dev, FALSE, 0, 2, x, y);
}
-void SynapticsScrollEvent(SynapticsPrivate *priv, VMask *scroll_mask)
+void SynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, double vert, double horiz)
{
struct SynapticsX11 *x11 = priv->frontend_data;
InputInfoPtr pInfo = x11->pInfo;
ValuatorMask *m = x11->event_mask;
- int i;
+
+ if (!which)
+ return;
valuator_mask_zero(x11->event_mask);
- for (i = 0; i < vmask_size(scroll_mask); i++) {
- double val;
- if (vmask_fetch_double(scroll_mask, i, &val))
- valuator_mask_set_double(m, i, val);
- }
+ if (which & SCROLL_VERT)
+ valuator_mask_set_double(m, priv->scroll_axis_vert, vert);
+ if (which & SCROLL_HORIZ)
+ valuator_mask_set_double(m, priv->scroll_axis_horiz, horiz);
xf86PostMotionEventM(pInfo->dev, FALSE, m);
}
diff --git a/src/synaptics.c b/src/synaptics.c
index 37a0fa1..5f10b72 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1914,20 +1914,22 @@ post_button_click(SynapticsPrivate *priv, const int button)
static void
post_scroll_events(SynapticsPrivate *priv)
{
+ unsigned int which = 0;
vmask_zero(priv->scroll_events_mask);
- if (priv->scroll.delta_y != 0.0) {
- vmask_set_double(priv->scroll_events_mask,
- priv->scroll_axis_vert, priv->scroll.delta_y);
- priv->scroll.delta_y = 0;
- }
- if (priv->scroll.delta_x != 0.0) {
- vmask_set_double(priv->scroll_events_mask,
- priv->scroll_axis_horiz, priv->scroll.delta_x);
+ if (priv->scroll.delta_y != 0.0)
+ which |= SCROLL_VERT;
+
+ if (priv->scroll.delta_x != 0.0)
+ which |= SCROLL_HORIZ;
+
+ if (which){
+ SynapticsScrollEvent(priv, which,
+ priv->scroll.delta_y,
+ priv->scroll.delta_x);
priv->scroll.delta_x = 0;
+ priv->scroll.delta_y = 0;
}
- if (vmask_num_valuators(priv->scroll_events_mask))
- SynapticsScrollEvent(priv, priv->scroll_events_mask);
}
/* Update the open slots and number of active touches */
diff --git a/src/synaptics.h b/src/synaptics.h
index fcfb877..6f4e662 100644
--- a/src/synaptics.h
+++ b/src/synaptics.h
@@ -54,7 +54,7 @@ void SynapticsMotionEvent(SynapticsPrivate *priv, int x, int y);
* Post a scroll event.
* Implemented-by: frontend
*/
-void SynapticsScrollEvent(SynapticsPrivate *priv, VMask *mask);
+void SynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, double vert, double horiz);
/**
* Post a touch event for the given touchid of the given type.
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 3c26d06..d8aed14 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -57,6 +57,11 @@ enum TouchEventType {
T_END = 2,
};
+enum ScrollEventType {
+ SCROLL_VERT = 1,
+ SCROLL_HORIZ = 2,
+};
+
typedef enum {
RT_TAP = 0, /* Right top corner */
RB_TAP, /* Right bottom corner */