diff options
author | marha <marha@users.sourceforge.net> | 2012-03-23 10:05:55 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-23 10:05:55 +0100 |
commit | 0f834b91a4768673833ab4917e87d86c237bb1a6 (patch) | |
tree | 363489504ed4b2d360259b8de4c9e392918e5d02 /xorg-server/Xi/listdev.c | |
parent | fc72edebf875378459368c5383d9023730cbca54 (diff) | |
download | vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.gz vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.bz2 vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.zip |
libX11 xserver fontconfig mesa pixman xkbcomp xkeyboard-config git update
23 Mar 2012
Diffstat (limited to 'xorg-server/Xi/listdev.c')
-rw-r--r-- | xorg-server/Xi/listdev.c | 133 |
1 files changed, 65 insertions, 68 deletions
diff --git a/xorg-server/Xi/listdev.c b/xorg-server/Xi/listdev.c index 1b3081d96..a02112f32 100644 --- a/xorg-server/Xi/listdev.c +++ b/xorg-server/Xi/listdev.c @@ -54,9 +54,9 @@ SOFTWARE. #include <dix-config.h> #endif -#include <X11/X.h> /* for inputstr.h */ -#include <X11/Xproto.h> /* Request macro */ -#include "inputstr.h" /* DeviceIntPtr */ +#include <X11/X.h> /* for inputstr.h */ +#include <X11/Xproto.h> /* Request macro */ +#include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "XIstubs.h" @@ -68,7 +68,6 @@ SOFTWARE. #include "listdev.h" - /*********************************************************************** * * This procedure lists the input devices available to the server. @@ -97,15 +96,15 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) *namesize += 1; if (d->name) - *namesize += strlen(d->name); + *namesize += strlen(d->name); if (d->key != NULL) - *size += sizeof(xKeyInfo); + *size += sizeof(xKeyInfo); if (d->button != NULL) - *size += sizeof(xButtonInfo); + *size += sizeof(xButtonInfo); if (d->valuator != NULL) { - chunks = ((int)d->valuator->numAxes + 19) / VPC; - *size += (chunks * sizeof(xValuatorInfo) + - d->valuator->numAxes * sizeof(xAxisInfo)); + chunks = ((int) d->valuator->numAxes + 19) / VPC; + *size += (chunks * sizeof(xValuatorInfo) + + d->valuator->numAxes * sizeof(xAxisInfo)); } } @@ -122,15 +121,16 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) static void CopyDeviceName(char **namebuf, char *name) { - char *nameptr = (char *)*namebuf; + char *nameptr = (char *) *namebuf; if (name) { - *nameptr++ = strlen(name); - strcpy(nameptr, name); - *namebuf += (strlen(name) + 1); - } else { - *nameptr++ = 0; - *namebuf += 1; + *nameptr++ = strlen(name); + strcpy(nameptr, name); + *namebuf += (strlen(name) + 1); + } + else { + *nameptr++ = 0; + *namebuf += 1; } } @@ -150,7 +150,7 @@ CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf) b2->length = sizeof(xButtonInfo); b2->num_buttons = b->numButtons; if (client && client->swapped) { - swaps(&b2->num_buttons); + swaps(&b2->num_buttons); } *buf += sizeof(xButtonInfo); } @@ -162,8 +162,7 @@ CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf) */ static void -CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, - char **buf) +CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, char **buf) { xDeviceInfoPtr dev; @@ -173,18 +172,18 @@ CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, dev->type = d->xinput_type; dev->num_classes = num_classes; if (IsMaster(d) && IsKeyboardDevice(d)) - dev->use = IsXKeyboard; + dev->use = IsXKeyboard; else if (IsMaster(d) && IsPointerDevice(d)) - dev->use = IsXPointer; + dev->use = IsXPointer; else if (d->valuator && d->button) dev->use = IsXExtensionPointer; else if (d->key && d->kbdfeed) dev->use = IsXExtensionKeyboard; else - dev->use = IsXExtensionDevice; + dev->use = IsXExtensionDevice; if (client->swapped) { - swapl(&dev->type); + swapl(&dev->type); } *buf += sizeof(xDeviceInfo); } @@ -207,7 +206,7 @@ CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf) k2->max_keycode = k->xkbInfo->desc->max_key_code; k2->num_keys = k2->max_keycode - k2->min_keycode + 1; if (client && client->swapped) { - swaps(&k2->num_keys); + swaps(&k2->num_keys); } *buf += sizeof(xKeyInfo); } @@ -234,54 +233,53 @@ CopySwapValuatorClass(ClientPtr client, DeviceIntPtr dev, char **buf) xAxisInfoPtr a2; for (i = 0, axes = v->numAxes; i < ((v->numAxes + 19) / VPC); - i++, axes -= VPC) { - t_axes = axes < VPC ? axes : VPC; - if (t_axes < 0) - t_axes = v->numAxes % VPC; - v2 = (xValuatorInfoPtr) * buf; - v2->class = ValuatorClass; - v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo); - v2->num_axes = t_axes; - v2->mode = valuator_get_mode(dev, 0); - v2->motion_buffer_size = v->numMotionEvents; - if (client && client->swapped) { - swapl(&v2->motion_buffer_size); - } - *buf += sizeof(xValuatorInfo); - a = v->axes + (VPC * i); - a2 = (xAxisInfoPtr) * buf; - for (j = 0; j < t_axes; j++) { - a2->min_value = a->min_value; - a2->max_value = a->max_value; - a2->resolution = a->resolution; - if (client && client->swapped) { - swapl(&a2->min_value); - swapl(&a2->max_value); - swapl(&a2->resolution); - } - a2++; - a++; - *buf += sizeof(xAxisInfo); - } + i++, axes -= VPC) { + t_axes = axes < VPC ? axes : VPC; + if (t_axes < 0) + t_axes = v->numAxes % VPC; + v2 = (xValuatorInfoPtr) * buf; + v2->class = ValuatorClass; + v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo); + v2->num_axes = t_axes; + v2->mode = valuator_get_mode(dev, 0); + v2->motion_buffer_size = v->numMotionEvents; + if (client && client->swapped) { + swapl(&v2->motion_buffer_size); + } + *buf += sizeof(xValuatorInfo); + a = v->axes + (VPC * i); + a2 = (xAxisInfoPtr) * buf; + for (j = 0; j < t_axes; j++) { + a2->min_value = a->min_value; + a2->max_value = a->max_value; + a2->resolution = a->resolution; + if (client && client->swapped) { + swapl(&a2->min_value); + swapl(&a2->max_value); + swapl(&a2->resolution); + } + a2++; + a++; + *buf += sizeof(xAxisInfo); + } } return i; } static void CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes, - char** classbuf) + char **classbuf) { if (dev->key != NULL) { - CopySwapKeyClass(client, dev->key, classbuf); - (*num_classes)++; + CopySwapKeyClass(client, dev->key, classbuf); + (*num_classes)++; } if (dev->button != NULL) { - CopySwapButtonClass(client, dev->button, classbuf); - (*num_classes)++; + CopySwapButtonClass(client, dev->button, classbuf); + (*num_classes)++; } if (dev->valuator != NULL) { - (*num_classes) += - CopySwapValuatorClass(client, dev, classbuf); + (*num_classes) += CopySwapValuatorClass(client, dev, classbuf); } } @@ -293,7 +291,7 @@ CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes, static void ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, - char **devbuf, char **classbuf, char **namebuf) + char **devbuf, char **classbuf, char **namebuf) { CopyDeviceName(namebuf, d->name); CopySwapDevice(client, d, 0, devbuf); @@ -310,16 +308,15 @@ static Bool ShouldSkipDevice(ClientPtr client, DeviceIntPtr d) { /* don't send master devices other than VCP/VCK */ - if (!IsMaster(d) || d == inputInfo.pointer || d == inputInfo.keyboard) - { + if (!IsMaster(d) || d == inputInfo.pointer ||d == inputInfo.keyboard) { int rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess); + if (rc == Success) return FALSE; } return TRUE; } - /*********************************************************************** * * This procedure lists the input devices available to the server. @@ -335,7 +332,7 @@ ProcXListInputDevices(ClientPtr client) { xListInputDevicesReply rep; int numdevs = 0; - int namesize = 1; /* need 1 extra byte for strcpy */ + int namesize = 1; /* need 1 extra byte for strcpy */ int i = 0, size = 0; int total_length; char *devbuf, *classbuf, *namebuf, *savbuf; @@ -378,7 +375,7 @@ ProcXListInputDevices(ClientPtr client) /* allocate space for reply */ total_length = numdevs * sizeof(xDeviceInfo) + size + namesize; - devbuf = (char *)calloc(1, total_length); + devbuf = (char *) calloc(1, total_length); classbuf = devbuf + (numdevs * sizeof(xDeviceInfo)); namebuf = classbuf + size; savbuf = devbuf; @@ -420,5 +417,5 @@ SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); - WriteToClient(client, size, (char *)rep); + WriteToClient(client, size, (char *) rep); } |