]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/xserver.git/blob - debian/patches/604-Move-AllowTouch-to-dix-touch.c-and-rename-to-TouchAc.patch
62207bebbc9c97398f27a06e7ae84573b1e221de
[glsdk/xserver.git] / debian / patches / 604-Move-AllowTouch-to-dix-touch.c-and-rename-to-TouchAc.patch
1 From 9a260e9af83feb5c53ffd3b2da2dc3adf06240a1 Mon Sep 17 00:00:00 2001
2 From: Chase Douglas <chase.douglas@canonical.com>
3 Date: Fri, 3 Feb 2012 16:19:08 -0800
4 Subject: [PATCH] Move AllowTouch to dix/touch.c, and rename to
5  TouchAcceptReject
7 Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
8 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
10 ---
11  Xi/xiallowev.c  |   46 ++--------------------------------------------
12  dix/touch.c     |   45 +++++++++++++++++++++++++++++++++++++++++++++
13  include/input.h |    2 ++
14  3 files changed, 49 insertions(+), 44 deletions(-)
16 diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c
17 index a4b2f57..dab3393 100644
18 --- a/Xi/xiallowev.c
19 +++ b/Xi/xiallowev.c
20 @@ -57,47 +57,6 @@ SProcXIAllowEvents(ClientPtr client)
21      return ProcXIAllowEvents(client);
22  }
23  
24 -static int
25 -AllowTouch(ClientPtr client, DeviceIntPtr dev, int mode, uint32_t touchid, XID *error)
26 -{
27 -    TouchPointInfoPtr ti;
28 -    int nev, i;
29 -    InternalEvent *events = InitEventList(GetMaximumEventsNum());
30 -
31 -    if (!events)
32 -        return BadAlloc;
33 -
34 -    if (!dev->touch)
35 -    {
36 -        *error = dev->id;
37 -        return BadDevice;
38 -    }
39 -
40 -    /* FIXME window is unhandled */
41 -
42 -    ti = TouchFindByClientID(dev, touchid);
43 -    if (!ti)
44 -    {
45 -        *error = touchid;
46 -        return BadValue;
47 -    }
48 -
49 -    /* FIXME: Allow for early accept */
50 -    if (ti->num_listeners == 0 || CLIENT_ID(ti->listeners[0].listener) != client->index)
51 -        return BadAccess;
52 -
53 -    nev = GetTouchOwnershipEvents(events, dev, ti, mode, ti->listeners[0].listener, 0);
54 -    if (nev == 0)
55 -        return BadAlloc;
56 -    for (i = 0; i < nev; i++)
57 -        mieqProcessDeviceEvent(dev, events + i, NULL);
58 -
59 -    ProcessInputEvents();
60 -
61 -    FreeEventList(events, GetMaximumEventsNum());
62 -    return Success;
63 -}
64 -
65  int
66  ProcXIAllowEvents(ClientPtr client)
67  {
68 @@ -138,9 +97,8 @@ ProcXIAllowEvents(ClientPtr client)
69         break;
70      case XIRejectTouch:
71      case XIAcceptTouch:
72 -        ret = AllowTouch(client, dev,
73 -                         stuff->mode, stuff->touchid,
74 -                         &client->errorValue);
75 +        ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid,
76 +                                &client->errorValue);
77          break;
78      default:
79         client->errorValue = stuff->mode;
80 diff --git a/dix/touch.c b/dix/touch.c
81 index b42859d..4a116ee 100644
82 --- a/dix/touch.c
83 +++ b/dix/touch.c
84 @@ -34,6 +34,7 @@
85  
86  #include "eventstr.h"
87  #include "exevents.h"
88 +#include "exglobals.h"
89  #include "inpututils.h"
90  #include "eventconvert.h"
91  #include "windowstr.h"
92 @@ -984,3 +985,47 @@ TouchListenerGone(XID resource)
93  
94      FreeEventList(events, GetMaximumEventsNum());
95  }
96 +
97 +int
98 +TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
99 +                  uint32_t touchid, XID *error)
100 +{
101 +    TouchPointInfoPtr ti;
102 +    int nev, i;
103 +    InternalEvent *events = InitEventList(GetMaximumEventsNum());
105 +    if (!events)
106 +        return BadAlloc;
108 +    if (!dev->touch)
109 +    {
110 +        *error = dev->id;
111 +        return BadDevice;
112 +    }
114 +    /* FIXME window is unhandled */
116 +    ti = TouchFindByClientID(dev, touchid);
117 +    if (!ti)
118 +    {
119 +        *error = touchid;
120 +        return BadValue;
121 +    }
123 +    /* FIXME: Allow for early accept */
124 +    if (ti->num_listeners == 0 ||
125 +        CLIENT_ID(ti->listeners[0].listener) != client->index)
126 +        return BadAccess;
128 +    nev = GetTouchOwnershipEvents(events, dev, ti, mode,
129 +                                  ti->listeners[0].listener, 0);
130 +    if (nev == 0)
131 +        return BadAlloc;
132 +    for (i = 0; i < nev; i++)
133 +        mieqProcessDeviceEvent(dev, events + i, NULL);
135 +    ProcessInputEvents();
137 +    FreeEventList(events, GetMaximumEventsNum());
138 +    return Success;
139 +}
140 diff --git a/include/input.h b/include/input.h
141 index 53645b4..605e74d 100644
142 --- a/include/input.h
143 +++ b/include/input.h
144 @@ -625,6 +625,8 @@ extern int TouchConvertToPointerEvent(const InternalEvent *ev,
145  extern int TouchGetPointerEventType(const InternalEvent *ev);
146  extern void TouchRemovePointerGrab(DeviceIntPtr dev);
147  extern void TouchListenerGone(XID resource);
148 +extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
149 +                             uint32_t touchid, XID *error);
150  
151  /* misc event helpers */
152  extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
153 -- 
154 1.7.8.3