~ubuntu-branches/ubuntu/edgy/xorg-server/edgy-updates

« back to all changes in this revision

Viewing changes to Xi/getprop.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Parra Novo
  • Date: 2006-07-25 20:06:28 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060725200628-gjmmd9gxfxdc4ejs
Tags: 1:1.1.1-0ubuntu1
* New Upstream version
* Changed Build-Depends from mesa-swrast-source to mesa-swx11-source,
  following Debian package nomenclature
* Re-did 12_security_policy_in_etc.diff for 1.1.1
* Dropped 15_security_allocate_local.diff (applied upstream)
* Dropped 16_SECURITY_setuid.diff (applied upstream)
* Dropped 000_ubuntu_fix_read_kernel_mapping.patch (applied upstream)
* Dropped 002_ubuntu_fix_for_certain_intel_chipsets.patch (applied upstream)
* Updated versioned Build-Depends on mesa-swx11-source to version
  6.5.0.cvs.20060725-0ubuntu1
* Added arrayobj.c, arrayobj.h, bitset.h & rbadaptors.h to
  GL/symlink-mesa.sh (linked from mesa-swx11-source)
* Added arrayobj.c to default build target on GL/mesa/main

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Xorg: getprop.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
2
 
 
3
1
/************************************************************
4
2
 
5
3
Copyright 1989, 1998  The Open Group
45
43
SOFTWARE.
46
44
 
47
45
********************************************************/
48
 
/* $XFree86: xc/programs/Xserver/Xi/getprop.c,v 3.5 2001/08/23 14:56:19 alanh Exp $ */
49
46
 
50
47
/***********************************************************************
51
48
 *
59
56
#include <dix-config.h>
60
57
#endif
61
58
 
62
 
#include <X11/X.h>                              /* for inputstr.h    */
63
 
#include <X11/Xproto.h>                 /* Request macro     */
64
 
#include "inputstr.h"                   /* DeviceIntPtr      */
65
 
#include "windowstr.h"                  /* window structs    */
 
59
#include <X11/X.h>      /* for inputstr.h    */
 
60
#include <X11/Xproto.h> /* Request macro     */
 
61
#include "inputstr.h"   /* DeviceIntPtr      */
 
62
#include "windowstr.h"  /* window structs    */
66
63
#include <X11/extensions/XI.h>
67
64
#include <X11/extensions/XIproto.h>
68
65
#include "extnsionst.h"
69
 
#include "extinit.h"                    /* LookupDeviceIntRec */
 
66
#include "extinit.h"    /* LookupDeviceIntRec */
70
67
#include "exglobals.h"
71
68
#include "swaprep.h"
72
69
 
73
70
#include "getprop.h"
74
71
 
75
 
extern                  XExtEventInfo EventInfo[];
76
 
extern int      ExtEventIndex;
 
72
extern XExtEventInfo EventInfo[];
 
73
extern int ExtEventIndex;
77
74
 
78
75
/***********************************************************************
79
76
 *
82
79
 */
83
80
 
84
81
int
85
 
SProcXGetDeviceDontPropagateList(client)
86
 
    register ClientPtr client;
87
 
    {
 
82
SProcXGetDeviceDontPropagateList(register ClientPtr client)
 
83
{
88
84
    register char n;
89
85
 
90
86
    REQUEST(xGetDeviceDontPropagateListReq);
91
87
    swaps(&stuff->length, n);
92
88
    REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
93
89
    swapl(&stuff->window, n);
94
 
    return(ProcXGetDeviceDontPropagateList(client));
95
 
    }
 
90
    return (ProcXGetDeviceDontPropagateList(client));
 
91
}
96
92
 
97
93
/***********************************************************************
98
94
 *
101
97
 */
102
98
 
103
99
int
104
 
ProcXGetDeviceDontPropagateList (client)
105
 
    register ClientPtr client;
106
 
    {
107
 
    CARD16                              count = 0;
108
 
    int                                 i;
109
 
    XEventClass                         *buf = NULL, *tbuf;
110
 
    WindowPtr                           pWin;
111
 
    xGetDeviceDontPropagateListReply    rep;
112
 
    OtherInputMasks                     *others;
 
100
ProcXGetDeviceDontPropagateList(register ClientPtr client)
 
101
{
 
102
    CARD16 count = 0;
 
103
    int i;
 
104
    XEventClass *buf = NULL, *tbuf;
 
105
    WindowPtr pWin;
 
106
    xGetDeviceDontPropagateListReply rep;
 
107
    OtherInputMasks *others;
113
108
 
114
109
    REQUEST(xGetDeviceDontPropagateListReq);
115
110
    REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
120
115
    rep.length = 0;
121
116
    rep.count = 0;
122
117
 
123
 
    pWin = (WindowPtr) LookupWindow (stuff->window, client);
124
 
    if (!pWin)
125
 
        {
 
118
    pWin = (WindowPtr) LookupWindow(stuff->window, client);
 
119
    if (!pWin) {
126
120
        client->errorValue = stuff->window;
127
 
        SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0, 
128
 
                BadWindow);
 
121
        SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0,
 
122
                          BadWindow);
129
123
        return Success;
130
 
        }
 
124
    }
131
125
 
132
 
    if ((others = wOtherInputMasks(pWin)) != 0)
133
 
        {
134
 
        for (i=0; i<EMASKSIZE; i++)
135
 
            tbuf = ClassFromMask (NULL, others->dontPropagateMask[i], i, 
136
 
                &count, COUNT);
137
 
        if (count)
138
 
            {
 
126
    if ((others = wOtherInputMasks(pWin)) != 0) {
 
127
        for (i = 0; i < EMASKSIZE; i++)
 
128
            tbuf = ClassFromMask(NULL, others->dontPropagateMask[i], i,
 
129
                                 &count, COUNT);
 
130
        if (count) {
139
131
            rep.count = count;
140
 
            buf = (XEventClass *) xalloc (rep.count * sizeof(XEventClass));
141
 
            rep.length = (rep.count * sizeof (XEventClass) + 3) >> 2;
 
132
            buf = (XEventClass *) xalloc(rep.count * sizeof(XEventClass));
 
133
            rep.length = (rep.count * sizeof(XEventClass) + 3) >> 2;
142
134
 
143
135
            tbuf = buf;
144
 
            for (i=0; i<EMASKSIZE; i++)
145
 
                tbuf = ClassFromMask (tbuf, others->dontPropagateMask[i], i, 
146
 
                    NULL, CREATE);
147
 
            }
148
 
        }
149
 
 
150
 
    WriteReplyToClient (client, sizeof (xGetDeviceDontPropagateListReply), 
151
 
        &rep);
152
 
 
153
 
    if (count)
154
 
        {
155
 
        client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
156
 
        WriteSwappedDataToClient( client, count * sizeof(XEventClass), buf);
157
 
        xfree (buf);
158
 
        }
 
136
            for (i = 0; i < EMASKSIZE; i++)
 
137
                tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i,
 
138
                                     NULL, CREATE);
 
139
        }
 
140
    }
 
141
 
 
142
    WriteReplyToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep);
 
143
 
 
144
    if (count) {
 
145
        client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 
146
        WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf);
 
147
        xfree(buf);
 
148
    }
159
149
    return Success;
160
 
    }
 
150
}
161
151
 
162
152
/***********************************************************************
163
153
 *
167
157
 */
168
158
 
169
159
XEventClass
170
 
*ClassFromMask (buf, mask, maskndx, count, mode)
171
 
    XEventClass *buf;
172
 
    Mask        mask;
173
 
    int         maskndx;
174
 
    CARD16      *count;
175
 
    int         mode;
176
 
    {
177
 
    int         i,j;
178
 
    int         id = maskndx;
179
 
    Mask        tmask = 0x80000000;
 
160
    * ClassFromMask(XEventClass * buf, Mask mask, int maskndx, CARD16 * count,
 
161
                    int mode)
 
162
{
 
163
    int i, j;
 
164
    int id = maskndx;
 
165
    Mask tmask = 0x80000000;
180
166
 
181
 
    for (i=0; i<32; i++,tmask>>=1)
182
 
        if (tmask & mask)
183
 
            {
184
 
            for (j=0; j<ExtEventIndex; j++)
185
 
                if (EventInfo[j].mask == tmask)
186
 
                    {
 
167
    for (i = 0; i < 32; i++, tmask >>= 1)
 
168
        if (tmask & mask) {
 
169
            for (j = 0; j < ExtEventIndex; j++)
 
170
                if (EventInfo[j].mask == tmask) {
187
171
                    if (mode == COUNT)
188
172
                        (*count)++;
189
173
                    else
190
 
                        *buf++ = (id << 8) | EventInfo[j].type;
191
 
                    }
192
 
            }
 
174
                        *buf++ = (id << 8) | EventInfo[j].type;
 
175
                }
 
176
        }
193
177
    return (buf);
194
 
    }
 
178
}
195
179
 
196
180
/***********************************************************************
197
181
 *
201
185
 */
202
186
 
203
187
void
204
 
SRepXGetDeviceDontPropagateList (client, size, rep)
205
 
    ClientPtr   client;
206
 
    int         size;
207
 
    xGetDeviceDontPropagateListReply    *rep;
208
 
    {
 
188
SRepXGetDeviceDontPropagateList(ClientPtr client, int size,
 
189
                                xGetDeviceDontPropagateListReply * rep)
 
190
{
209
191
    register char n;
210
192
 
211
193
    swaps(&rep->sequenceNumber, n);
212
194
    swapl(&rep->length, n);
213
195
    swaps(&rep->count, n);
214
196
    WriteToClient(client, size, (char *)rep);
215
 
    }
 
197
}