aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@alnilam.(none)>2010-01-30 16:03:44 +0100
committerHenrik Rydberg <rydberg@alnilam.(none)>2010-01-30 16:03:44 +0100
commit3ad5cb92c93d712f8b3e341947a8a798f5b3bc2e (patch)
tree0841e04566ec5a89d5cddba294d61d3f70ef662a /src
parent0e711b50d648fd724a9c09da7f1f0317fdeb269f (diff)
downloadxorg-input-kobomultitouch-3ad5cb92c93d712f8b3e341947a8a798f5b3bc2e.tar.gz
xorg-input-kobomultitouch-3ad5cb92c93d712f8b3e341947a8a798f5b3bc2e.tar.bz2
xorg-input-kobomultitouch-3ad5cb92c93d712f8b3e341947a8a798f5b3bc2e.zip
horizontal and vertical scroll now works again
The buttons reported to X did not include the scrolling buttons, effectively disabling scrolling alltogether. Fixed.
Diffstat (limited to 'src')
-rw-r--r--src/hwdata.h2
-rw-r--r--src/multitouch.c17
2 files changed, 13 insertions, 6 deletions
diff --git a/src/hwdata.h b/src/hwdata.h
index 1c38ed5..806f43d 100644
--- a/src/hwdata.h
+++ b/src/hwdata.h
@@ -24,7 +24,7 @@
#include "common.h"
-#define DIM_BUTTON 3
+#define DIM_BUTTON 7
#define MT_BUTTON_LEFT 0
#define MT_BUTTON_MIDDLE 1
diff --git a/src/multitouch.c b/src/multitouch.c
index e2309bd..233f6a3 100644
--- a/src/multitouch.c
+++ b/src/multitouch.c
@@ -26,6 +26,11 @@
#include <xserver-properties.h>
#endif
+////////////////////////////////////////////////////////////////////////////
+
+// these should be user-configurable at some point
+static const float vscroll_fraction = 0.05;
+static const float hscroll_fraction = 0.2;
////////////////////////////////////////////////////////////////////////////
@@ -92,7 +97,7 @@ static void InitButtonLabels(Atom *labels, int nlabels)
static int device_init(DeviceIntPtr dev, LocalDevicePtr local)
{
struct MTouch *mt = local->private;
- unsigned char btmap[DIM_BUTTON + 1]={0,1,2,3};
+ unsigned char btmap[DIM_BUTTON + 1]={0,1,2,3,4,5,6,7};
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
Atom btn_labels[SYN_MAX_BUTTONS] = { 0 };
Atom axes_labels[2] = { 0 };
@@ -211,6 +216,12 @@ static void handle_gestures(LocalDevicePtr local,
const struct Capabilities *caps)
{
static int vscroll, hscroll;
+ int vstep = 1 +
+ vscroll_fraction * (caps->abs_position_y.maximum -
+ caps->abs_position_y.minimum);
+ int hstep = 1 +
+ hscroll_fraction * (caps->abs_position_x.maximum -
+ caps->abs_position_x.minimum);
int i;
for (i = 0; i < gs->nbt; i++) {
xf86PostButtonEvent(local->dev, FALSE,
@@ -224,8 +235,6 @@ static void handle_gestures(LocalDevicePtr local,
xf86Msg(X_INFO, "motion: %d %d\n", gs->dx, gs->dy);
}
if (GETBIT(gs->type, GS_VSCROLL)) {
- int vstep = 0.03 * (caps->abs_position_y.maximum -
- caps->abs_position_y.minimum);
vscroll += gs->dy;
while (vscroll > vstep) {
tickle_button(local, 5);
@@ -238,8 +247,6 @@ static void handle_gestures(LocalDevicePtr local,
xf86Msg(X_INFO, "vscroll: %d\n", gs->dy);
}
if (GETBIT(gs->type, GS_HSCROLL)) {
- int hstep = 0.1 * (caps->abs_position_x.maximum -
- caps->abs_position_x.minimum);
hscroll += gs->dx;
while (hscroll > hstep) {
tickle_button(local, 6);