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

« back to all changes in this revision

Viewing changes to Xi/grabdevb.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: grabdevb.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/grabdevb.c,v 3.2 2001/01/17 22:13:25 dawes 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 structure  */
 
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 structure  */
66
63
#include <X11/extensions/XI.h>
67
64
#include <X11/extensions/XIproto.h>
68
65
#include "exevents.h"
69
66
#include "extnsionst.h"
70
 
#include "extinit.h"                    /* LookupDeviceIntRec */
 
67
#include "extinit.h"    /* LookupDeviceIntRec */
71
68
#include "exglobals.h"
72
69
 
73
70
#include "grabdev.h"
80
77
 */
81
78
 
82
79
int
83
 
SProcXGrabDeviceButton(client)
84
 
    register ClientPtr client;
85
 
    {
 
80
SProcXGrabDeviceButton(register ClientPtr client)
 
81
{
86
82
    register char n;
87
83
    register long *p;
88
84
    register int i;
93
89
    swapl(&stuff->grabWindow, n);
94
90
    swaps(&stuff->modifiers, n);
95
91
    swaps(&stuff->event_count, n);
96
 
    p = (long *) &stuff[1];
97
 
    for (i=0; i<stuff->event_count; i++)
98
 
        {
99
 
        swapl(p, n);
 
92
    p = (long *)&stuff[1];
 
93
    for (i = 0; i < stuff->event_count; i++) {
 
94
        swapl(p, n);
100
95
        p++;
101
 
        }
102
 
 
103
 
    return(ProcXGrabDeviceButton(client));
104
96
    }
105
97
 
 
98
    return (ProcXGrabDeviceButton(client));
 
99
}
 
100
 
106
101
/***********************************************************************
107
102
 *
108
103
 * Grab a button on an extension device.
110
105
 */
111
106
 
112
107
int
113
 
ProcXGrabDeviceButton(client)
114
 
    ClientPtr client;
115
 
    {
116
 
    int                 ret;
117
 
    DeviceIntPtr        dev;
118
 
    DeviceIntPtr        mdev;
119
 
    XEventClass         *class;
120
 
    struct tmask        tmp[EMASKSIZE];
 
108
ProcXGrabDeviceButton(ClientPtr client)
 
109
{
 
110
    int ret;
 
111
    DeviceIntPtr dev;
 
112
    DeviceIntPtr mdev;
 
113
    XEventClass *class;
 
114
    struct tmask tmp[EMASKSIZE];
121
115
 
122
116
    REQUEST(xGrabDeviceButtonReq);
123
117
    REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
124
118
 
125
 
    if (stuff->length !=(sizeof(xGrabDeviceButtonReq)>>2) + stuff->event_count)
126
 
        {
127
 
        SendErrorToClient (client, IReqCode, X_GrabDeviceButton, 0, BadLength);
 
119
    if (stuff->length !=
 
120
        (sizeof(xGrabDeviceButtonReq) >> 2) + stuff->event_count) {
 
121
        SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadLength);
128
122
        return Success;
129
 
        }
 
123
    }
130
124
 
131
 
    dev = LookupDeviceIntRec (stuff->grabbed_device);
132
 
    if (dev == NULL)
133
 
        {
134
 
        SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, 
135
 
            BadDevice);
 
125
    dev = LookupDeviceIntRec(stuff->grabbed_device);
 
126
    if (dev == NULL) {
 
127
        SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadDevice);
136
128
        return Success;
137
 
        }
138
 
    if (stuff->modifier_device != UseXKeyboard)
139
 
        {
140
 
        mdev = LookupDeviceIntRec (stuff->modifier_device);
141
 
        if (mdev == NULL)
142
 
            {
143
 
            SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, 
144
 
                BadDevice);
145
 
            return Success;
146
 
            }
147
 
        if (mdev->key == NULL)
148
 
            {
149
 
            SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, 
150
 
                BadMatch);
151
 
            return Success;
152
 
            }
153
 
        }
154
 
    else
 
129
    }
 
130
    if (stuff->modifier_device != UseXKeyboard) {
 
131
        mdev = LookupDeviceIntRec(stuff->modifier_device);
 
132
        if (mdev == NULL) {
 
133
            SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
 
134
                              BadDevice);
 
135
            return Success;
 
136
        }
 
137
        if (mdev->key == NULL) {
 
138
            SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
 
139
                              BadMatch);
 
140
            return Success;
 
141
        }
 
142
    } else
155
143
        mdev = (DeviceIntPtr) LookupKeyboardDevice();
156
144
 
157
145
    class = (XEventClass *) (&stuff[1]);        /* first word of values */
158
146
 
159
 
    if ((ret = CreateMaskFromList (client, class,
160
 
        stuff->event_count, tmp, dev, X_GrabDeviceButton)) != Success)
161
 
            return Success;
162
 
    ret = GrabButton(client, dev, stuff->this_device_mode, 
163
 
        stuff->other_devices_mode, stuff->modifiers, mdev, stuff->button, 
164
 
        stuff->grabWindow, stuff->ownerEvents, (Cursor)0, (Window)0, 
165
 
        tmp[stuff->grabbed_device].mask);
 
147
    if ((ret = CreateMaskFromList(client, class,
 
148
                                  stuff->event_count, tmp, dev,
 
149
                                  X_GrabDeviceButton)) != Success)
 
150
        return Success;
 
151
    ret = GrabButton(client, dev, stuff->this_device_mode,
 
152
                     stuff->other_devices_mode, stuff->modifiers, mdev,
 
153
                     stuff->button, stuff->grabWindow, stuff->ownerEvents,
 
154
                     (Cursor) 0, (Window) 0, tmp[stuff->grabbed_device].mask);
166
155
 
167
156
    if (ret != Success)
168
157
        SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, ret);
169
 
    return(Success);
170
 
    }
 
158
    return (Success);
 
159
}