diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-06-15 22:01:02 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-06-16 02:30:55 +0200 |
| commit | 8aa197872ac49d7dc53a4832bf4ff175525e6939 (patch) | |
| tree | 81a49a7a7e37483507015bdcf77cb57fa8e0ec0a | |
| parent | 8dff8642c43a473713d48533974d9c7883bbc5c1 (diff) | |
janitor: Simplify gesture tracing
It is more convenient to print out the gesture at will than
having trace commands all over the code.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| -rw-r--r-- | driver/multitouch.c | 51 |
1 files changed, 16 insertions, 35 deletions
diff --git a/driver/multitouch.c b/driver/multitouch.c index 7233aa2..0809948 100644 --- a/driver/multitouch.c +++ b/driver/multitouch.c | |||
| @@ -34,15 +34,6 @@ static const float hswipe_fraction = 0.25; | |||
| 34 | static const float scale_fraction = 0.05; | 34 | static const float scale_fraction = 0.05; |
| 35 | static const float rot_fraction = 0.05; | 35 | static const float rot_fraction = 0.05; |
| 36 | 36 | ||
| 37 | /* flip these to enable event debugging */ | ||
| 38 | #if 1 | ||
| 39 | #define TRACE1(format, arg1) | ||
| 40 | #define TRACE2(format, arg1, arg2) | ||
| 41 | #else | ||
| 42 | #define TRACE1(format, arg1) xf86Msg(X_INFO, format, arg1) | ||
| 43 | #define TRACE2(format, arg1, arg2) xf86Msg(X_INFO, format, arg1, arg2) | ||
| 44 | #endif | ||
| 45 | |||
| 46 | /* button mapping simplified */ | 37 | /* button mapping simplified */ |
| 47 | #define PROPMAP(m, x, y) m[x] = XIGetKnownProperty(y) | 38 | #define PROPMAP(m, x, y) m[x] = XIGetKnownProperty(y) |
| 48 | 39 | ||
| @@ -217,12 +208,6 @@ static void handle_gestures(LocalDevicePtr local, | |||
| 217 | const struct Capabilities *caps) | 208 | const struct Capabilities *caps) |
| 218 | { | 209 | { |
| 219 | static int vscroll, hscroll, vswipe, hswipe, scale, rot; | 210 | static int vscroll, hscroll, vswipe, hswipe, scale, rot; |
| 220 | int vscrollstep = 1 + vscroll_fraction * get_cap_ysize(caps); | ||
| 221 | int hscrollstep = 1 + hscroll_fraction * get_cap_xsize(caps); | ||
| 222 | int vswipestep = 1 + vswipe_fraction * get_cap_ysize(caps); | ||
| 223 | int hswipestep = 1 + hswipe_fraction * get_cap_xsize(caps); | ||
| 224 | int scalestep = 1 + scale_fraction * get_cap_xsize(caps); | ||
| 225 | int rotstep = 1 + rot_fraction * get_cap_xsize(caps); | ||
| 226 | int i; | 211 | int i; |
| 227 | if (!gs->same_fingers) { | 212 | if (!gs->same_fingers) { |
| 228 | vscroll = 0; | 213 | vscroll = 0; |
| @@ -231,40 +216,36 @@ static void handle_gestures(LocalDevicePtr local, | |||
| 231 | hswipe = 0; | 216 | hswipe = 0; |
| 232 | } | 217 | } |
| 233 | for (i = 0; i < DIM_BUTTON; i++) { | 218 | for (i = 0; i < DIM_BUTTON; i++) { |
| 234 | if (GETBIT(gs->btmask, i)) { | 219 | if (GETBIT(gs->btmask, i)) |
| 235 | xf86PostButtonEvent(local->dev, FALSE, | 220 | xf86PostButtonEvent(local->dev, FALSE, |
| 236 | i + 1, GETBIT(gs->btdata, i), 0, 0); | 221 | i + 1, GETBIT(gs->btdata, i), 0, 0); |
| 237 | TRACE2("button bit: %d %d\n", i, GETBIT(gs->btdata, i)); | ||
| 238 | } | ||
| 239 | } | ||
| 240 | if (GETBIT(gs->type, GS_MOVE)) { | ||
| 241 | xf86PostMotionEvent(local->dev, 0, 0, 2, | ||
| 242 | gs->dx, gs->dy); | ||
| 243 | TRACE2("motion: %d %d\n", gs->dx, gs->dy); | ||
| 244 | } | 222 | } |
| 223 | if (GETBIT(gs->type, GS_MOVE)) | ||
| 224 | xf86PostMotionEvent(local->dev, 0, 0, 2, gs->dx, gs->dy); | ||
| 225 | |||
| 245 | if (GETBIT(gs->type, GS_VSCROLL)) { | 226 | if (GETBIT(gs->type, GS_VSCROLL)) { |
| 246 | button_scroll(local, 4, 5, &vscroll, vscrollstep, gs->dy); | 227 | int step = 1 + vscroll_fraction * get_cap_ysize(caps); |
| 247 | TRACE1("vscroll: %d\n", gs->dy); | 228 | button_scroll(local, 4, 5, &vscroll, step, gs->dy); |
| 248 | } | 229 | } |
| 249 | if (GETBIT(gs->type, GS_HSCROLL)) { | 230 | if (GETBIT(gs->type, GS_HSCROLL)) { |
| 250 | button_scroll(local, 6, 7, &hscroll, hscrollstep, gs->dx); | 231 | int step = 1 + hscroll_fraction * get_cap_xsize(caps); |
| 251 | TRACE1("hscroll: %d\n", gs->dx); | 232 | button_scroll(local, 6, 7, &hscroll, step, gs->dx); |
| 252 | } | 233 | } |
| 253 | if (GETBIT(gs->type, GS_VSWIPE)) { | 234 | if (GETBIT(gs->type, GS_VSWIPE)) { |
| 254 | button_scroll(local, 8, 9, &vswipe, vswipestep, gs->dy); | 235 | int step = 1 + vswipe_fraction * get_cap_ysize(caps); |
| 255 | TRACE1("vswipe: %d\n", gs->dy); | 236 | button_scroll(local, 8, 9, &vswipe, step, gs->dy); |
| 256 | } | 237 | } |
| 257 | if (GETBIT(gs->type, GS_HSWIPE)) { | 238 | if (GETBIT(gs->type, GS_HSWIPE)) { |
| 258 | button_scroll(local, 10, 11, &hswipe, hswipestep, gs->dx); | 239 | int step = 1 + hswipe_fraction * get_cap_xsize(caps); |
| 259 | TRACE1("hswipe: %d\n", gs->dx); | 240 | button_scroll(local, 10, 11, &hswipe, step, gs->dx); |
| 260 | } | 241 | } |
| 261 | if (GETBIT(gs->type, GS_SCALE)) { | 242 | if (GETBIT(gs->type, GS_SCALE)) { |
| 262 | button_scroll(local, 12, 13, &scale, scalestep, gs->scale); | 243 | int step = 1 + scale_fraction * get_cap_xsize(caps); |
| 263 | TRACE1("scale: %d\n", gs->scale); | 244 | button_scroll(local, 12, 13, &scale, step, gs->scale); |
| 264 | } | 245 | } |
| 265 | if (GETBIT(gs->type, GS_ROTATE)) { | 246 | if (GETBIT(gs->type, GS_ROTATE)) { |
| 266 | button_scroll(local, 14, 15, &rot, rotstep, gs->rot); | 247 | int step = 1 + rot_fraction * get_cap_xsize(caps); |
| 267 | TRACE1("rotate: %d\n", gs->rot); | 248 | button_scroll(local, 14, 15, &rot, step, gs->rot); |
| 268 | } | 249 | } |
| 269 | } | 250 | } |
| 270 | 251 | ||
