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

« back to all changes in this revision

Viewing changes to Xi/getkmap.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: getkmap.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/getkmap.c,v 3.3 2001/01/17 22:13:24 dawes Exp $ */
49
46
 
50
47
/********************************************************************
51
48
 *
53
50
 *
54
51
 */
55
52
 
56
 
#define  NEED_EVENTS                    /* for inputstr.h    */
 
53
#define  NEED_EVENTS    /* for inputstr.h    */
57
54
#define  NEED_REPLIES
58
55
#ifdef HAVE_DIX_CONFIG_H
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      */
 
59
#include <X11/X.h>      /* for inputstr.h    */
 
60
#include <X11/Xproto.h> /* Request macro     */
 
61
#include "inputstr.h"   /* DeviceIntPtr      */
65
62
#include <X11/extensions/XI.h>
66
63
#include <X11/extensions/XIproto.h>
67
64
#include "extnsionst.h"
68
 
#include "extinit.h"                    /* LookupDeviceIntRec */
 
65
#include "extinit.h"    /* LookupDeviceIntRec */
69
66
#include "exglobals.h"
70
67
#include "swaprep.h"
71
68
 
79
76
 */
80
77
 
81
78
int
82
 
SProcXGetDeviceKeyMapping(client)
83
 
    register ClientPtr client;
84
 
    {
 
79
SProcXGetDeviceKeyMapping(register ClientPtr client)
 
80
{
85
81
    register char n;
86
82
 
87
83
    REQUEST(xGetDeviceKeyMappingReq);
88
84
    swaps(&stuff->length, n);
89
 
    return(ProcXGetDeviceKeyMapping(client));
90
 
    }
 
85
    return (ProcXGetDeviceKeyMapping(client));
 
86
}
91
87
 
92
88
/***********************************************************************
93
89
 *
96
92
 */
97
93
 
98
94
int
99
 
ProcXGetDeviceKeyMapping(client)
100
 
    register ClientPtr client;
101
 
    {
 
95
ProcXGetDeviceKeyMapping(register ClientPtr client)
 
96
{
102
97
    xGetDeviceKeyMappingReply rep;
103
98
    DeviceIntPtr dev;
104
 
    KeySymsPtr  k;
 
99
    KeySymsPtr k;
105
100
 
106
101
    REQUEST(xGetDeviceKeyMappingReq);
107
102
    REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
108
103
 
109
 
    dev = LookupDeviceIntRec (stuff->deviceid);
110
 
    if (dev == NULL)
111
 
        {
112
 
        SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0, 
113
 
                BadDevice);
 
104
    dev = LookupDeviceIntRec(stuff->deviceid);
 
105
    if (dev == NULL) {
 
106
        SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0,
 
107
                          BadDevice);
114
108
        return Success;
115
 
        }
 
109
    }
116
110
 
117
 
    if (dev->key == NULL)
118
 
        {
119
 
        SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0, 
120
 
                BadMatch);
 
111
    if (dev->key == NULL) {
 
112
        SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadMatch);
121
113
        return Success;
122
 
        }
123
 
    k =  &dev->key->curKeySyms;
 
114
    }
 
115
    k = &dev->key->curKeySyms;
124
116
 
125
117
    if ((stuff->firstKeyCode < k->minKeyCode) ||
126
 
        (stuff->firstKeyCode > k->maxKeyCode))
127
 
        {
 
118
        (stuff->firstKeyCode > k->maxKeyCode)) {
128
119
        client->errorValue = stuff->firstKeyCode;
129
 
        SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0, 
130
 
                BadValue);
 
120
        SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
131
121
        return Success;
132
 
        }
 
122
    }
133
123
 
134
 
    if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1)
135
 
        {
 
124
    if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1) {
136
125
        client->errorValue = stuff->count;
137
 
        SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0, 
138
 
                BadValue);
 
126
        SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
139
127
        return Success;
140
 
        }
 
128
    }
141
129
 
142
130
    rep.repType = X_Reply;
143
131
    rep.RepType = X_GetDeviceKeyMapping;
144
132
    rep.sequenceNumber = client->sequence;
145
133
    rep.keySymsPerKeyCode = k->mapWidth;
146
 
    rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */
 
134
    rep.length = (k->mapWidth * stuff->count);  /* KeySyms are 4 bytes */
147
135
    WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
148
136
 
149
 
    client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
150
 
    WriteSwappedDataToClient(
151
 
        client,
152
 
        k->mapWidth * stuff->count * sizeof(KeySym),
153
 
        &k->map[(stuff->firstKeyCode - k->minKeyCode) *
154
 
        k->mapWidth]);
 
137
    client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
 
138
    WriteSwappedDataToClient(client,
 
139
                             k->mapWidth * stuff->count * sizeof(KeySym),
 
140
                             &k->map[(stuff->firstKeyCode - k->minKeyCode) *
 
141
                                     k->mapWidth]);
155
142
 
156
143
    return Success;
157
 
    }
 
144
}
158
145
 
159
146
/***********************************************************************
160
147
 *
164
151
 */
165
152
 
166
153
void
167
 
SRepXGetDeviceKeyMapping (client, size, rep)
168
 
    ClientPtr   client;
169
 
    int         size;
170
 
    xGetDeviceKeyMappingReply   *rep;
171
 
    {
 
154
SRepXGetDeviceKeyMapping(ClientPtr client, int size,
 
155
                         xGetDeviceKeyMappingReply * rep)
 
156
{
172
157
    register char n;
173
158
 
174
159
    swaps(&rep->sequenceNumber, n);
175
160
    swapl(&rep->length, n);
176
161
    WriteToClient(client, size, (char *)rep);
177
 
    }
178
 
 
 
162
}