~peter-pearse/ubuntu/oneiric/xserver-xorg-input-evdev/prop001

« back to all changes in this revision

Viewing changes to debian/patches/101-gestures.patch

  • Committer: Bazaar Package Importer
  • Author(s): Chase Douglas
  • Date: 2011-02-21 18:50:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110221185015-tenmhisvy6d29bki
Tags: 1:2.6.0-1ubuntu7
* Drop 100-fix-touchup-problem-on-touchpads.patch
  - Upstream fixed the issue
* Add xi 2.1 support
  - Added 100-xi2.1.patch
  - Refreshed 101-gestures.patch
  - Bump dependency on xserver-xorg-dev for xi 2.1
  - Add new xi 2.1 dependency on libmtdev-dev and libutouch-grail1-dev
  - Bump runtime dependency on libutouch-grail1 to 1.0.19
* Revert rule for Magic Trackpad, synaptics will handle it now

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 9950e5b2e2019698a3ddc3eac608a43a974860ea Mon Sep 17 00:00:00 2001
2
 
From: Chase Douglas <chase.douglas@canonical.com>
3
 
Date: Tue, 25 Jan 2011 22:35:07 -0500
4
 
Subject: [PATCH] Gesture patch
5
 
 
6
 
---
7
 
 configure.ac       |   16 +++
8
 
 src/Makefile.am    |    7 +-
9
 
 src/evdev-grail.c  |  304 ++++++++++++++++++++++++++++++++++++++++++++++++++++
10
 
 src/evdev-grail.h  |    9 ++
11
 
 src/evdev.c        |   28 ++++--
12
 
 src/evdev.h        |    6 +
13
 
 src/gestureproto.h |  132 +++++++++++++++++++++++
14
 
 7 files changed, 493 insertions(+), 9 deletions(-)
15
 
 create mode 100644 src/evdev-grail.c
16
 
 create mode 100644 src/evdev-grail.h
17
 
 create mode 100644 src/gestureproto.h
18
 
 
 
1
diff --git a/configure.ac b/configure.ac
 
2
index b4b0bad..86a18ae 100644
19
3
--- a/configure.ac
20
4
+++ b/configure.ac
21
 
@@ -65,6 +65,22 @@ sdkdir=`$PKG_CONFIG --variable=sdkdir xo
 
5
@@ -68,6 +68,22 @@ sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
22
6
 AC_ARG_WITH([sdkdir], [], [sdkdir="$withval"])
23
7
 AC_SUBST([sdkdir])
24
8
 
41
25
 DRIVER_NAME=evdev
42
26
 AC_SUBST([DRIVER_NAME])
43
27
 
 
28
diff --git a/src/Makefile.am b/src/Makefile.am
 
29
index b8d0dd9..7d05a50 100644
44
30
--- a/src/Makefile.am
45
31
+++ b/src/Makefile.am
46
 
@@ -32,8 +32,15 @@ AM_CPPFLAGS =-I$(top_srcdir)/include
47
 
 @DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
 
32
@@ -29,12 +29,17 @@ AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
 
33
 AM_CPPFLAGS =-I$(top_srcdir)/include
 
34
 
 
35
 @DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
 
36
-@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
 
37
+@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version @GRAIL_LIBS@
 
38
 @DRIVER_NAME@_drv_la_LIBADD = $(MTDEV_LIBS)
48
39
 @DRIVER_NAME@_drv_ladir = @inputdir@
49
40
 
50
 
+@DRIVER_NAME@_drv_la_LIBADD = @GRAIL_LIBS@
51
 
+
52
41
+if USE_GRAIL
53
42
+GRAIL_SRC=evdev-grail.c evdev-grail.h
54
43
+endif
59
48
                                emuMB.c \
60
49
                                emuWheel.c \
61
50
                                draglock.c
 
51
diff --git a/src/evdev-grail.c b/src/evdev-grail.c
 
52
new file mode 100644
 
53
index 0000000..03689ed
62
54
--- /dev/null
63
55
+++ b/src/evdev-grail.c
64
 
@@ -0,0 +1,304 @@
 
56
@@ -0,0 +1,375 @@
65
57
+/*
66
58
+ * Copyright © 2010 Canonical, Ltd.
67
59
+ *
170
162
+{
171
163
+    WindowPtr child_window;
172
164
+    WindowPtr window;
173
 
+    WindowPtr root_window = NULL;
 
165
+    WindowPtr root_window;
174
166
+    InputInfoPtr pInfo = grail->priv;
175
167
+    EvdevPtr pEvdev = pInfo->private;
176
168
+    int j;
202
194
+
203
195
+    memset(clients, 0, sizeof(struct grail_client_info) * max_clients);
204
196
+
 
197
+    /* Find the root window. */
 
198
+    for (root_window = child_window; root_window->parent;
 
199
+         root_window = root_window->parent);
 
200
+
 
201
+    /*
 
202
+     * Check for a root client with SYSFLAG1 set. SYSFLAG1 is effectively an
 
203
+     * active grab for system gestures. We assume only one client has SYSFLAG1
 
204
+     * set.
 
205
+     */
 
206
+    window = child_window;
 
207
+    while (window)
 
208
+    {
 
209
+        /* Check if any gestures have been selected on this window. */
 
210
+        if (wGestureMasks(window))
 
211
+        {
 
212
+            GestureClientsPtr client;
 
213
+
 
214
+            /* For each client */
 
215
+            for (client = wGestureMasks(window)->clients; client;
 
216
+                 client = client->next)
 
217
+            {
 
218
+                int first = 1;
 
219
+
 
220
+                /* If the client has set the SYSFLAG1 bit */
 
221
+                if (BitIsOn(client->gestureMask[0], GRAIL_TYPE_SYSFLAG1))
 
222
+                {
 
223
+                    /* For each recognized gesture */
 
224
+                    grail_mask_foreach(type, types, type_bytes)
 
225
+                    {
 
226
+                        if (type == GRAIL_TYPE_SYSFLAG1)
 
227
+                            continue;
 
228
+
 
229
+                        /*
 
230
+                         * Check if this client selected for this gesture.
 
231
+                         * Request may be for this device or all devices.
 
232
+                         */
 
233
+                        if (BitIsOn(client->gestureMask[pInfo->dev->id], type) ||
 
234
+                            BitIsOn(client->gestureMask[0], type))
 
235
+                        {
 
236
+                            if (first) {
 
237
+                                /* Set up new client in array */
 
238
+                                clients[0].id.client = CLIENT_ID(client->resource);
 
239
+                                clients[0].id.root = root_window->drawable.id;
 
240
+                                clients[0].id.child = child_window->drawable.id;
 
241
+                                clients[0].id.event = root_window->drawable.id;
 
242
+                                grail_mask_clear(clients[0].mask,
 
243
+                                                 DIM_GRAIL_TYPE_BYTES);
 
244
+                                first = 0;
 
245
+                            }
 
246
+
 
247
+                            /* Set this gesture bit in the client's gesture mask */
 
248
+                            SetBit(clients[0].mask, type);
 
249
+                            num_clients = 1;
 
250
+                        }
 
251
+                    }
 
252
+
 
253
+                    /*
 
254
+                     * Either we found a gesture, or we stop looking for SYSFLAG1
 
255
+                     * clients.
 
256
+                     */
 
257
+                    if (num_clients) {
 
258
+                        SetBit(clients[0].mask, GRAIL_TYPE_SYSFLAG1);
 
259
+                        goto next_window;
 
260
+                    }
 
261
+                }
 
262
+            }
 
263
+        }
 
264
+
 
265
+next_window:
 
266
+        window = window->parent;
 
267
+    }
 
268
+
205
269
+    /*
206
270
+     * Traverse the window hierarchy looking for a window with a client
207
271
+     * selecting for one of the recognized gestures.
222
286
+        /* For each recognized gesture */
223
287
+        grail_mask_foreach(type, types, type_bytes)
224
288
+        {
 
289
+            if (type == GRAIL_TYPE_SYSFLAG1)
 
290
+                continue;
 
291
+
225
292
+            /* Check if any client selected for this gesture on the window */
226
293
+            if (BitIsOn(wGestureMasks(window)->mask, type))
227
294
+            {
228
295
+                GestureClientsPtr client;
229
296
+
230
 
+                if (!root_window)
231
 
+                    for (root_window = window; root_window->parent;
232
 
+                         root_window = root_window->parent);
233
 
+
234
297
+                /* For each client that selected for gestures on this window */
235
298
+                for (client = wGestureMasks(window)->clients; client;
236
299
+                     client = client->next)
366
429
+        pEvdev->grail = NULL;
367
430
+    }
368
431
+}
 
432
diff --git a/src/evdev-grail.h b/src/evdev-grail.h
 
433
new file mode 100644
 
434
index 0000000..5c93f15
369
435
--- /dev/null
370
436
+++ b/src/evdev-grail.h
371
437
@@ -0,0 +1,9 @@
378
444
+extern void GrailClose(InputInfoPtr pInfo);
379
445
+
380
446
+#endif /* _EVDEV_GRAIL_H_ */
 
447
diff --git a/src/evdev.c b/src/evdev.c
 
448
index 1915e98..8764b63 100644
381
449
--- a/src/evdev.c
382
450
+++ b/src/evdev.c
383
 
@@ -71,6 +71,13 @@
 
451
@@ -60,6 +60,13 @@
384
452
 #define MAXDEVICES MAX_DEVICES
385
453
 #endif
386
454
 
394
462
 #define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
395
463
 
396
464
 #define MIN_KEYCODE 8
397
 
@@ -829,7 +836,7 @@ EvdevProcessSyncEvent(InputInfoPtr pInfo
 
465
@@ -897,7 +904,7 @@ EvdevProcessSyncEvent(InputInfoPtr pInfo, struct input_event *ev)
398
466
  * Process the events from the device; nothing is actually posted to the server
399
467
  * until an EV_SYN event is received.
400
468
  */
403
471
 EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
404
472
 {
405
473
     switch (ev->type) {
406
 
@@ -863,7 +870,14 @@ EvdevReadInput(InputInfoPtr pInfo)
 
474
@@ -931,17 +938,14 @@ EvdevReadInput(InputInfoPtr pInfo)
407
475
 
408
476
     while (len == sizeof(ev))
409
477
     {
410
 
-        len = read(pInfo->fd, &ev, sizeof(ev));
 
478
-#ifdef MULTITOUCH
411
479
+#if USE_GRAIL
412
 
+        EvdevPtr pEvdev = pInfo->private;
413
 
+
 
480
         EvdevPtr pEvdev = pInfo->private;
 
481
 
 
482
-        if (pEvdev->mtdev)
 
483
-            len = mtdev_get(pEvdev->mtdev, pInfo->fd, ev, NUM_EVENTS) *
 
484
-                sizeof(struct input_event);
414
485
+        if (pEvdev->grail)
415
486
+            len = grail_pull(pEvdev->grail, pInfo->fd);
416
 
+        else
417
 
+#endif
 
487
         else
 
488
-            len = read(pInfo->fd, &ev, sizeof(ev));
 
489
-#else
 
490
-            len = read(pInfo->fd, &ev, sizeof(ev));
 
491
 #endif
418
492
+            len = read(pInfo->fd, &ev, sizeof(ev));
419
493
         if (len <= 0)
420
494
         {
421
495
             if (errno == ENODEV) /* May happen after resume */
422
 
@@ -881,6 +895,11 @@ EvdevReadInput(InputInfoPtr pInfo)
 
496
@@ -959,6 +963,11 @@ EvdevReadInput(InputInfoPtr pInfo)
423
497
             break;
424
498
         }
425
499
 
431
505
         /* The kernel promises that we always only read a complete
432
506
          * event, so len != sizeof ev is an error. */
433
507
         if (len % sizeof(ev[0])) {
434
 
@@ -1305,7 +1324,7 @@ EvdevAddAbsClass(DeviceIntPtr device)
435
 
     memset(pEvdev->old_vals, -1, num_axes * sizeof(int));
436
 
     atoms = malloc(pEvdev->num_vals * sizeof(Atom));
437
 
 
438
 
-    for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MAX; axis++) {
439
 
+    for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MISC; axis++) {
440
 
         pEvdev->axis_map[axis] = -1;
441
 
         if (!TestBit(axis, pEvdev->abs_bitmask))
442
 
             continue;
443
 
@@ -1328,7 +1347,7 @@ EvdevAddAbsClass(DeviceIntPtr device)
444
 
         return !Success;
445
 
     }
446
 
 
447
 
-    for (axis = ABS_X; axis <= ABS_MAX; axis++) {
448
 
+    for (axis = ABS_X; axis <= ABS_MISC; axis++) {
449
 
         int axnum = pEvdev->axis_map[axis];
450
 
         int resolution = 10000;
451
 
 
452
 
@@ -1394,6 +1413,8 @@ EvdevAddAbsClass(DeviceIntPtr device)
453
 
         free(mode);
454
 
     }
455
 
 
456
 
+    GrailOpen(pInfo);
457
 
+
458
 
     return Success;
459
 
 }
460
 
 
461
 
@@ -1761,6 +1782,7 @@ EvdevProc(DeviceIntPtr device, int what)
462
 
             close(pInfo->fd);
463
 
             pInfo->fd = -1;
464
 
         }
 
508
@@ -1613,6 +1622,7 @@ EvdevProc(DeviceIntPtr device, int what)
 
509
         if (pEvdev->mtdev)
 
510
             mtdev_close(pEvdev->mtdev);
 
511
 #endif
465
512
+        GrailClose(pInfo);
466
513
         EvdevRemoveDevice(pInfo);
467
514
         pEvdev->min_maj = 0;
468
515
        break;
 
516
@@ -1850,6 +1860,8 @@ EvdevProbe(InputInfoPtr pInfo)
 
517
         xf86Msg(X_PROBED, "%s: Found absolute axes\n", pInfo->name);
 
518
         pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS;
 
519
 
 
520
+        GrailOpen(pInfo);
 
521
+
 
522
         if ((TestBit(ABS_X, pEvdev->abs_bitmask) &&
 
523
              TestBit(ABS_Y, pEvdev->abs_bitmask))) {
 
524
             xf86Msg(X_PROBED, "%s: Found x and y absolute axes\n", pInfo->name);
 
525
diff --git a/src/evdev.h b/src/evdev.h
 
526
index 3c49e91..6b67104 100644
469
527
--- a/src/evdev.h
470
528
+++ b/src/evdev.h
471
 
@@ -196,8 +196,14 @@ typedef struct {
 
529
@@ -205,8 +205,14 @@ typedef struct {
472
530
     /* Event queue used to defer keyboard/button events until EV_SYN time. */
473
531
     int                     num_queue;
474
532
     EventQueueRec           queue[EVDEV_MAXQUEUE];
483
541
 /* Event posting functions */
484
542
 void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value);
485
543
 void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value);
 
544
diff --git a/src/gestureproto.h b/src/gestureproto.h
 
545
new file mode 100644
 
546
index 0000000..a60dcb8
486
547
--- /dev/null
487
548
+++ b/src/gestureproto.h
488
549
@@ -0,0 +1,132 @@