aboutsummaryrefslogtreecommitdiffstats
path: root/src/multitouch.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-05-13 23:21:37 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-05-14 01:41:39 +0200
commita2ef8bcda6cd3864b4c367579defb52ecad19657 (patch)
tree902391874bd1982f99854c33728abdee77913004 /src/multitouch.c
parent32dea71a85ac1b46c35bf85f456f3c4772b30e76 (diff)
downloadxorg-input-kobomultitouch-a2ef8bcda6cd3864b4c367579defb52ecad19657.tar.gz
xorg-input-kobomultitouch-a2ef8bcda6cd3864b4c367579defb52ecad19657.tar.bz2
xorg-input-kobomultitouch-a2ef8bcda6cd3864b4c367579defb52ecad19657.zip
Add scale gesture
Moving two fingers apart or closer together will trigger the gesture. This patch computes the scaling gesture and maps it to mouse buttons 12 and 13. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/multitouch.c')
-rw-r--r--src/multitouch.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/multitouch.c b/src/multitouch.c
index a11b8da..6281a5b 100644
--- a/src/multitouch.c
+++ b/src/multitouch.c
@@ -31,6 +31,7 @@ static const float vscroll_fraction = 0.05;
static const float hscroll_fraction = 0.05;
static const float vswipe_fraction = 0.25;
static const float hswipe_fraction = 0.25;
+static const float scale_fraction = 0.05;
/* flip these to enable event debugging */
#if 1
@@ -81,6 +82,9 @@ static void initButtonLabels(Atom map[DIM_BUTTON])
PROPMAP(map, MT_BUTTON_SWIPE_DOWN, BTN_LABEL_PROP_BTN_1);
PROPMAP(map, MT_BUTTON_SWIPE_LEFT, BTN_LABEL_PROP_BTN_2);
PROPMAP(map, MT_BUTTON_SWIPE_RIGHT, BTN_LABEL_PROP_BTN_3);
+ /* how to map scale and rotate? */
+ PROPMAP(map, MT_BUTTON_SCALE_DOWN, BTN_LABEL_PROP_BTN_4);
+ PROPMAP(map, MT_BUTTON_SCALE_UP, BTN_LABEL_PROP_BTN_5);
}
#endif
@@ -88,7 +92,7 @@ static int device_init(DeviceIntPtr dev, LocalDevicePtr local)
{
struct MTouch *mt = local->private;
unsigned char btmap[DIM_BUTTON + 1] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
};
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
Atom axes_labels[2], btn_labels[DIM_BUTTON];
@@ -209,11 +213,12 @@ static void handle_gestures(LocalDevicePtr local,
const struct Gestures *gs,
const struct Capabilities *caps)
{
- static int vscroll, hscroll, vswipe, hswipe;
+ static int vscroll, hscroll, vswipe, hswipe, scale;
int vscrollstep = 1 + vscroll_fraction * get_cap_ysize(caps);
int hscrollstep = 1 + hscroll_fraction * get_cap_xsize(caps);
int vswipestep = 1 + vswipe_fraction * get_cap_ysize(caps);
int hswipestep = 1 + hswipe_fraction * get_cap_xsize(caps);
+ int scalestep = 1 + scale_fraction * get_cap_xsize(caps);
int i;
if (!gs->same_fingers) {
vscroll = 0;
@@ -249,6 +254,10 @@ static void handle_gestures(LocalDevicePtr local,
button_scroll(local, 10, 11, &hswipe, hswipestep, gs->dx);
TRACE1("hswipe: %d\n", gs->dx);
}
+ if (GETBIT(gs->type, GS_SCALE)) {
+ button_scroll(local, 12, 13, &scale, scalestep, gs->scale);
+ TRACE1("scale: %d\n", gs->scale);
+ }
}
/* called for each full received packet from the touchpad */