diff options
Diffstat (limited to 'Xi/getprop.c')
-rw-r--r-- | Xi/getprop.c | 122 |
1 files changed, 57 insertions, 65 deletions
diff --git a/Xi/getprop.c b/Xi/getprop.c index bbca24574..530841032 100644 --- a/Xi/getprop.c +++ b/Xi/getprop.c @@ -1,5 +1,3 @@ -/* $Xorg: getprop.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */ - /************************************************************ Copyright 1989, 1998 The Open Group @@ -45,7 +43,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/Xi/getprop.c,v 3.5 2001/08/23 14:56:19 alanh Exp $ */ /*********************************************************************** * @@ -59,21 +56,21 @@ SOFTWARE. #include <dix-config.h> #endif -#include <X11/X.h> /* for inputstr.h */ -#include <X11/Xproto.h> /* Request macro */ -#include "inputstr.h" /* DeviceIntPtr */ -#include "windowstr.h" /* window structs */ +#include <X11/X.h> /* for inputstr.h */ +#include <X11/Xproto.h> /* Request macro */ +#include "inputstr.h" /* DeviceIntPtr */ +#include "windowstr.h" /* window structs */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "extnsionst.h" -#include "extinit.h" /* LookupDeviceIntRec */ +#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "swaprep.h" #include "getprop.h" -extern XExtEventInfo EventInfo[]; -extern int ExtEventIndex; +extern XExtEventInfo EventInfo[]; +extern int ExtEventIndex; /*********************************************************************** * @@ -90,8 +87,8 @@ SProcXGetDeviceDontPropagateList(register ClientPtr client) swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq); swapl(&stuff->window, n); - return(ProcXGetDeviceDontPropagateList(client)); - } + return (ProcXGetDeviceDontPropagateList(client)); +} /*********************************************************************** * @@ -100,14 +97,14 @@ SProcXGetDeviceDontPropagateList(register ClientPtr client) */ int -ProcXGetDeviceDontPropagateList (register ClientPtr client) +ProcXGetDeviceDontPropagateList(register ClientPtr client) { - CARD16 count = 0; - int i; - XEventClass *buf = NULL, *tbuf; - WindowPtr pWin; - xGetDeviceDontPropagateListReply rep; - OtherInputMasks *others; + CARD16 count = 0; + int i; + XEventClass *buf = NULL, *tbuf; + WindowPtr pWin; + xGetDeviceDontPropagateListReply rep; + OtherInputMasks *others; REQUEST(xGetDeviceDontPropagateListReq); REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq); @@ -118,44 +115,39 @@ ProcXGetDeviceDontPropagateList (register ClientPtr client) rep.length = 0; rep.count = 0; - pWin = (WindowPtr) LookupWindow (stuff->window, client); - if (!pWin) - { + pWin = (WindowPtr) LookupWindow(stuff->window, client); + if (!pWin) { client->errorValue = stuff->window; - SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0, - BadWindow); + SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0, + BadWindow); return Success; - } - - if ((others = wOtherInputMasks(pWin)) != 0) - { - for (i=0; i<EMASKSIZE; i++) - tbuf = ClassFromMask (NULL, others->dontPropagateMask[i], i, - &count, COUNT); - if (count) - { + } + + if ((others = wOtherInputMasks(pWin)) != 0) { + for (i = 0; i < EMASKSIZE; i++) + tbuf = ClassFromMask(NULL, others->dontPropagateMask[i], i, + &count, COUNT); + if (count) { rep.count = count; - buf = (XEventClass *) xalloc (rep.count * sizeof(XEventClass)); - rep.length = (rep.count * sizeof (XEventClass) + 3) >> 2; + buf = (XEventClass *) xalloc(rep.count * sizeof(XEventClass)); + rep.length = (rep.count * sizeof(XEventClass) + 3) >> 2; tbuf = buf; - for (i=0; i<EMASKSIZE; i++) - tbuf = ClassFromMask (tbuf, others->dontPropagateMask[i], i, - NULL, CREATE); - } + for (i = 0; i < EMASKSIZE; i++) + tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i, + NULL, CREATE); } + } - WriteReplyToClient (client, sizeof (xGetDeviceDontPropagateListReply), - &rep); + WriteReplyToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep); - if (count) - { - client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write; - WriteSwappedDataToClient( client, count * sizeof(XEventClass), buf); - xfree (buf); - } - return Success; + if (count) { + client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; + WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf); + xfree(buf); } + return Success; +} /*********************************************************************** * @@ -165,26 +157,25 @@ ProcXGetDeviceDontPropagateList (register ClientPtr client) */ XEventClass -*ClassFromMask (XEventClass *buf, Mask mask, int maskndx, CARD16 *count, int mode) + * ClassFromMask(XEventClass * buf, Mask mask, int maskndx, CARD16 * count, + int mode) { - int i,j; - int id = maskndx; - Mask tmask = 0x80000000; - - for (i=0; i<32; i++,tmask>>=1) - if (tmask & mask) - { - for (j=0; j<ExtEventIndex; j++) - if (EventInfo[j].mask == tmask) - { + int i, j; + int id = maskndx; + Mask tmask = 0x80000000; + + for (i = 0; i < 32; i++, tmask >>= 1) + if (tmask & mask) { + for (j = 0; j < ExtEventIndex; j++) + if (EventInfo[j].mask == tmask) { if (mode == COUNT) (*count)++; else - *buf++ = (id << 8) | EventInfo[j].type; - } - } + *buf++ = (id << 8) | EventInfo[j].type; + } + } return (buf); - } +} /*********************************************************************** * @@ -194,7 +185,8 @@ XEventClass */ void -SRepXGetDeviceDontPropagateList (ClientPtr client, int size, xGetDeviceDontPropagateListReply *rep) +SRepXGetDeviceDontPropagateList(ClientPtr client, int size, + xGetDeviceDontPropagateListReply * rep) { register char n; @@ -202,4 +194,4 @@ SRepXGetDeviceDontPropagateList (ClientPtr client, int size, xGetDeviceDontPropa swapl(&rep->length, n); swaps(&rep->count, n); WriteToClient(client, size, (char *)rep); - } +} |