Static cleanup on Xi/
This commit is contained in:
parent
4b5802ddbd
commit
e88fa75c9b
261
Xi/chgfctl.c
261
Xi/chgfctl.c
|
@ -89,137 +89,13 @@ SProcXChangeFeedbackControl(register ClientPtr client)
|
|||
return (ProcXChangeFeedbackControl(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Change the control attributes.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXChangeFeedbackControl(ClientPtr client)
|
||||
{
|
||||
unsigned len;
|
||||
DeviceIntPtr dev;
|
||||
KbdFeedbackPtr k;
|
||||
PtrFeedbackPtr p;
|
||||
IntegerFeedbackPtr i;
|
||||
StringFeedbackPtr s;
|
||||
BellFeedbackPtr b;
|
||||
LedFeedbackPtr l;
|
||||
|
||||
REQUEST(xChangeFeedbackControlReq);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
|
||||
|
||||
len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2);
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
switch (stuff->feedbackid) {
|
||||
case KbdFeedbackClass:
|
||||
if (len != (sizeof(xKbdFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (k = dev->kbdfeed; k; k = k->next)
|
||||
if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeKbdFeedback(client, dev, stuff->mask, k,
|
||||
(xKbdFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case PtrFeedbackClass:
|
||||
if (len != (sizeof(xPtrFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (p = dev->ptrfeed; p; p = p->next)
|
||||
if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangePtrFeedback(client, dev, stuff->mask, p,
|
||||
(xPtrFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case StringFeedbackClass:
|
||||
{
|
||||
register char n;
|
||||
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]);
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&f->num_keysyms, n);
|
||||
}
|
||||
if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (s = dev->stringfeed; s; s = s->next)
|
||||
if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeStringFeedback(client, dev, stuff->mask, s,
|
||||
(xStringFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IntegerFeedbackClass:
|
||||
if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (i = dev->intfeed; i; i = i->next)
|
||||
if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeIntegerFeedback(client, dev, stuff->mask, i,
|
||||
(xIntegerFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case LedFeedbackClass:
|
||||
if (len != (sizeof(xLedFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (l = dev->leds; l; l = l->next)
|
||||
if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeLedFeedback(client, dev, stuff->mask, l,
|
||||
(xLedFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case BellFeedbackClass:
|
||||
if (len != (sizeof(xBellFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (b = dev->bell; b; b = b->next)
|
||||
if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeBellFeedback(client, dev, stuff->mask, b,
|
||||
(xBellFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This procedure changes KbdFeedbackClass data.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
static int
|
||||
ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
||||
KbdFeedbackPtr k, xKbdFeedbackCtl * f)
|
||||
{
|
||||
|
@ -351,7 +227,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
*
|
||||
*/
|
||||
|
||||
int
|
||||
static int
|
||||
ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
||||
PtrFeedbackPtr p, xPtrFeedbackCtl * f)
|
||||
{
|
||||
|
@ -422,7 +298,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
*
|
||||
*/
|
||||
|
||||
int
|
||||
static int
|
||||
ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
|
||||
long unsigned int mask, IntegerFeedbackPtr i,
|
||||
xIntegerFeedbackCtl * f)
|
||||
|
@ -445,7 +321,7 @@ ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
|
|||
*
|
||||
*/
|
||||
|
||||
int
|
||||
static int
|
||||
ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
|
||||
long unsigned int mask, StringFeedbackPtr s,
|
||||
xStringFeedbackCtl * f)
|
||||
|
@ -495,7 +371,7 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
|
|||
*
|
||||
*/
|
||||
|
||||
int
|
||||
static int
|
||||
ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
|
||||
long unsigned int mask, BellFeedbackPtr b,
|
||||
xBellFeedbackCtl * f)
|
||||
|
@ -560,7 +436,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
|
|||
*
|
||||
*/
|
||||
|
||||
int
|
||||
static int
|
||||
ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
||||
LedFeedbackPtr l, xLedFeedbackCtl * f)
|
||||
{
|
||||
|
@ -585,3 +461,128 @@ ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Change the control attributes.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXChangeFeedbackControl(ClientPtr client)
|
||||
{
|
||||
unsigned len;
|
||||
DeviceIntPtr dev;
|
||||
KbdFeedbackPtr k;
|
||||
PtrFeedbackPtr p;
|
||||
IntegerFeedbackPtr i;
|
||||
StringFeedbackPtr s;
|
||||
BellFeedbackPtr b;
|
||||
LedFeedbackPtr l;
|
||||
|
||||
REQUEST(xChangeFeedbackControlReq);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
|
||||
|
||||
len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2);
|
||||
dev = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (dev == NULL) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
switch (stuff->feedbackid) {
|
||||
case KbdFeedbackClass:
|
||||
if (len != (sizeof(xKbdFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (k = dev->kbdfeed; k; k = k->next)
|
||||
if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeKbdFeedback(client, dev, stuff->mask, k,
|
||||
(xKbdFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case PtrFeedbackClass:
|
||||
if (len != (sizeof(xPtrFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (p = dev->ptrfeed; p; p = p->next)
|
||||
if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangePtrFeedback(client, dev, stuff->mask, p,
|
||||
(xPtrFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case StringFeedbackClass:
|
||||
{
|
||||
register char n;
|
||||
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]);
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&f->num_keysyms, n);
|
||||
}
|
||||
if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (s = dev->stringfeed; s; s = s->next)
|
||||
if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeStringFeedback(client, dev, stuff->mask, s,
|
||||
(xStringFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IntegerFeedbackClass:
|
||||
if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (i = dev->intfeed; i; i = i->next)
|
||||
if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeIntegerFeedback(client, dev, stuff->mask, i,
|
||||
(xIntegerFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case LedFeedbackClass:
|
||||
if (len != (sizeof(xLedFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (l = dev->leds; l; l = l->next)
|
||||
if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeLedFeedback(client, dev, stuff->mask, l,
|
||||
(xLedFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case BellFeedbackClass:
|
||||
if (len != (sizeof(xBellFeedbackCtl) >> 2)) {
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (b = dev->bell; b; b = b->next)
|
||||
if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) {
|
||||
ChangeBellFeedback(client, dev, stuff->mask, b,
|
||||
(xBellFeedbackCtl *) & stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
42
Xi/chgfctl.h
42
Xi/chgfctl.h
|
@ -36,46 +36,4 @@ int SProcXChangeFeedbackControl(ClientPtr /* client */
|
|||
int ProcXChangeFeedbackControl(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ChangeKbdFeedback(ClientPtr /* client */ ,
|
||||
DeviceIntPtr /* dev */ ,
|
||||
unsigned long /* mask */ ,
|
||||
KbdFeedbackPtr /* k */ ,
|
||||
xKbdFeedbackCtl * /* f */
|
||||
);
|
||||
|
||||
int ChangePtrFeedback(ClientPtr /* client */ ,
|
||||
DeviceIntPtr /* dev */ ,
|
||||
unsigned long /* mask */ ,
|
||||
PtrFeedbackPtr /* p */ ,
|
||||
xPtrFeedbackCtl * /* f */
|
||||
);
|
||||
|
||||
int ChangeIntegerFeedback(ClientPtr /* client */ ,
|
||||
DeviceIntPtr /* dev */ ,
|
||||
unsigned long /* mask */ ,
|
||||
IntegerFeedbackPtr /* i */ ,
|
||||
xIntegerFeedbackCtl * /* f */
|
||||
);
|
||||
|
||||
int ChangeStringFeedback(ClientPtr /* client */ ,
|
||||
DeviceIntPtr /* dev */ ,
|
||||
unsigned long /* mask */ ,
|
||||
StringFeedbackPtr /* s */ ,
|
||||
xStringFeedbackCtl * /* f */
|
||||
);
|
||||
|
||||
int ChangeBellFeedback(ClientPtr /* client */ ,
|
||||
DeviceIntPtr /* dev */ ,
|
||||
unsigned long /* mask */ ,
|
||||
BellFeedbackPtr /* b */ ,
|
||||
xBellFeedbackCtl * /* f */
|
||||
);
|
||||
|
||||
int ChangeLedFeedback(ClientPtr /* client */ ,
|
||||
DeviceIntPtr /* dev */ ,
|
||||
unsigned long /* mask */ ,
|
||||
LedFeedbackPtr /* l */ ,
|
||||
xLedFeedbackCtl * /* f */
|
||||
);
|
||||
|
||||
#endif /* CHGFCTL_H */
|
||||
|
|
|
@ -45,12 +45,4 @@ void SendEventToAllWindows(DeviceIntPtr /* dev */ ,
|
|||
int /* count */
|
||||
);
|
||||
|
||||
void FindInterestedChildren( /* FIXME: could be static? */
|
||||
DeviceIntPtr /* dev */ ,
|
||||
WindowPtr /* p1 */ ,
|
||||
Mask /* mask */ ,
|
||||
xEvent * /* ev */ ,
|
||||
int /* count */
|
||||
);
|
||||
|
||||
#endif /* CHGPTR_H */
|
||||
|
|
|
@ -87,6 +87,53 @@ SProcXCloseDevice(register ClientPtr client)
|
|||
return (ProcXCloseDevice(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Clear out event selections and passive grabs from a window for the
|
||||
* specified device.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
|
||||
{
|
||||
InputClientsPtr others;
|
||||
OtherInputMasks *pOthers;
|
||||
GrabPtr grab, next;
|
||||
|
||||
if ((pOthers = wOtherInputMasks(pWin)) != 0)
|
||||
for (others = pOthers->inputClients; others; others = others->next)
|
||||
if (SameClient(others, client))
|
||||
others->mask[dev->id] = NoEventMask;
|
||||
|
||||
for (grab = wPassiveGrabs(pWin); grab; grab = next) {
|
||||
next = grab->next;
|
||||
if ((grab->device == dev) &&
|
||||
(client->clientAsMask == CLIENT_BITS(grab->resource)))
|
||||
FreeResource(grab->resource, RT_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Walk througth the window tree, deleting event selections for this client
|
||||
* from this device from all windows.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client)
|
||||
{
|
||||
WindowPtr p2;
|
||||
|
||||
while (p1) {
|
||||
p2 = p1->firstChild;
|
||||
DeleteDeviceEvents(dev, p1, client);
|
||||
DeleteEventsFromChildren(dev, p2, client);
|
||||
p1 = p1->nextSib;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure closes an input device.
|
||||
|
@ -126,50 +173,3 @@ ProcXCloseDevice(register ClientPtr client)
|
|||
CloseInputDevice(d, client);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Walk througth the window tree, deleting event selections for this client
|
||||
* from this device from all windows.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client)
|
||||
{
|
||||
WindowPtr p2;
|
||||
|
||||
while (p1) {
|
||||
p2 = p1->firstChild;
|
||||
DeleteDeviceEvents(dev, p1, client);
|
||||
DeleteEventsFromChildren(dev, p2, client);
|
||||
p1 = p1->nextSib;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Clear out event selections and passive grabs from a window for the
|
||||
* specified device.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
|
||||
{
|
||||
InputClientsPtr others;
|
||||
OtherInputMasks *pOthers;
|
||||
GrabPtr grab, next;
|
||||
|
||||
if ((pOthers = wOtherInputMasks(pWin)) != 0)
|
||||
for (others = pOthers->inputClients; others; others = others->next)
|
||||
if (SameClient(others, client))
|
||||
others->mask[dev->id] = NoEventMask;
|
||||
|
||||
for (grab = wPassiveGrabs(pWin); grab; grab = next) {
|
||||
next = grab->next;
|
||||
if ((grab->device == dev) &&
|
||||
(client->clientAsMask == CLIENT_BITS(grab->resource)))
|
||||
FreeResource(grab->resource, RT_NONE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,14 +36,4 @@ int SProcXCloseDevice(ClientPtr /* client */
|
|||
int ProcXCloseDevice(ClientPtr /* client */
|
||||
);
|
||||
|
||||
void DeleteEventsFromChildren(DeviceIntPtr /* dev */ ,
|
||||
WindowPtr /* p1 */ ,
|
||||
ClientPtr /* client */
|
||||
);
|
||||
|
||||
void DeleteDeviceEvents(DeviceIntPtr /* dev */ ,
|
||||
WindowPtr /* pWin */ ,
|
||||
ClientPtr /* client */
|
||||
);
|
||||
|
||||
#endif /* CLOSEDEV_H */
|
||||
|
|
|
@ -994,33 +994,7 @@ ChangeKeyMapping(ClientPtr client,
|
|||
return client->noClientException;
|
||||
}
|
||||
|
||||
void
|
||||
DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
|
||||
{
|
||||
int i;
|
||||
DeviceIntPtr dev;
|
||||
InputClientsPtr ic;
|
||||
struct _OtherInputMasks *inputMasks;
|
||||
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
||||
if (dev == inputInfo.pointer || dev == inputInfo.keyboard)
|
||||
continue;
|
||||
DeleteDeviceFromAnyExtEvents(pWin, dev);
|
||||
}
|
||||
|
||||
for (dev = inputInfo.off_devices; dev; dev = dev->next)
|
||||
DeleteDeviceFromAnyExtEvents(pWin, dev);
|
||||
|
||||
if (freeResources)
|
||||
while ((inputMasks = wOtherInputMasks(pWin)) != 0) {
|
||||
ic = inputMasks->inputClients;
|
||||
for (i = 0; i < EMASKSIZE; i++)
|
||||
inputMasks->dontPropagateMask[i] = 0;
|
||||
FreeResource(ic->resource, RT_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev)
|
||||
{
|
||||
WindowPtr parent;
|
||||
|
@ -1085,6 +1059,32 @@ DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev)
|
|||
dev->valuator->motionHintWindow = NullWindow;
|
||||
}
|
||||
|
||||
void
|
||||
DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
|
||||
{
|
||||
int i;
|
||||
DeviceIntPtr dev;
|
||||
InputClientsPtr ic;
|
||||
struct _OtherInputMasks *inputMasks;
|
||||
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
||||
if (dev == inputInfo.pointer || dev == inputInfo.keyboard)
|
||||
continue;
|
||||
DeleteDeviceFromAnyExtEvents(pWin, dev);
|
||||
}
|
||||
|
||||
for (dev = inputInfo.off_devices; dev; dev = dev->next)
|
||||
DeleteDeviceFromAnyExtEvents(pWin, dev);
|
||||
|
||||
if (freeResources)
|
||||
while ((inputMasks = wOtherInputMasks(pWin)) != 0) {
|
||||
ic = inputMasks->inputClients;
|
||||
for (i = 0; i < EMASKSIZE; i++)
|
||||
inputMasks->dontPropagateMask[i] = 0;
|
||||
FreeResource(ic->resource, RT_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask)
|
||||
{
|
||||
|
@ -1138,7 +1138,7 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type,
|
|||
}
|
||||
}
|
||||
|
||||
Mask
|
||||
static Mask
|
||||
DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
|
||||
{
|
||||
register InputClientsPtr other;
|
||||
|
@ -1223,7 +1223,7 @@ ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents)
|
|||
*
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask,
|
||||
xEvent * ev, int count)
|
||||
{
|
||||
|
|
|
@ -45,7 +45,6 @@ extern Mask DevicePointerMotionMask;
|
|||
extern Mask DevicePointerMotionHintMask;
|
||||
extern Mask DeviceFocusChangeMask;
|
||||
extern Mask DeviceStateNotifyMask;
|
||||
extern Mask ChangeDeviceNotifyMask;
|
||||
extern Mask DeviceMappingNotifyMask;
|
||||
extern Mask DeviceOwnerGrabButtonMask;
|
||||
extern Mask DeviceButtonGrabMask;
|
||||
|
|
382
Xi/extinit.c
382
Xi/extinit.c
|
@ -161,7 +161,7 @@ Mask DevicePointerMotionMask;
|
|||
Mask DevicePointerMotionHintMask;
|
||||
Mask DeviceFocusChangeMask;
|
||||
Mask DeviceStateNotifyMask;
|
||||
Mask ChangeDeviceNotifyMask;
|
||||
static Mask ChangeDeviceNotifyMask;
|
||||
Mask DeviceMappingNotifyMask;
|
||||
Mask DeviceOwnerGrabButtonMask;
|
||||
Mask DeviceButtonGrabMask;
|
||||
|
@ -208,51 +208,6 @@ static XExtensionVersion thisversion = { XI_Present,
|
|||
XI_Add_DevicePresenceNotify_Minor
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* IExtensionInit - initialize the input extension.
|
||||
*
|
||||
* Called from InitExtensions in main() or from QueryExtension() if the
|
||||
* extension is dynamically loaded.
|
||||
*
|
||||
* This extension has several events and errors.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
XInputExtensionInit(void)
|
||||
{
|
||||
ExtensionEntry *extEntry;
|
||||
|
||||
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
|
||||
SProcIDispatch, IResetProc, StandardMinorOpcode);
|
||||
if (extEntry) {
|
||||
IReqCode = extEntry->base;
|
||||
AllExtensionVersions[IReqCode - 128] = thisversion;
|
||||
MakeDeviceTypeAtoms();
|
||||
RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone);
|
||||
FixExtensionEvents(extEntry);
|
||||
ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
|
||||
EventSwapVector[DeviceValuator] = SEventIDispatch;
|
||||
EventSwapVector[DeviceKeyPress] = SEventIDispatch;
|
||||
EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
|
||||
EventSwapVector[DeviceButtonPress] = SEventIDispatch;
|
||||
EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
|
||||
EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceFocusIn] = SEventIDispatch;
|
||||
EventSwapVector[DeviceFocusOut] = SEventIDispatch;
|
||||
EventSwapVector[ProximityIn] = SEventIDispatch;
|
||||
EventSwapVector[ProximityOut] = SEventIDispatch;
|
||||
EventSwapVector[DeviceStateNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
|
||||
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
|
||||
} else {
|
||||
FatalError("IExtensionInit: AddExtensions failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* ProcIDispatch - main dispatch routine for requests to this extension.
|
||||
|
@ -260,7 +215,7 @@ XInputExtensionInit(void)
|
|||
*
|
||||
*/
|
||||
|
||||
int
|
||||
static int
|
||||
ProcIDispatch(register ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
@ -349,7 +304,7 @@ ProcIDispatch(register ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
int
|
||||
static int
|
||||
SProcIDispatch(register ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
@ -441,7 +396,7 @@ SProcIDispatch(register ClientPtr client)
|
|||
if (rep->RepType == X_##code) \
|
||||
SRepX##code (client, len, (x##code##Reply *) rep)
|
||||
|
||||
void
|
||||
static void
|
||||
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
|
||||
/* All we look at is the type field */
|
||||
{ /* This is common to all replies */
|
||||
|
@ -500,68 +455,13 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* SEventIDispatch
|
||||
*
|
||||
* Swap any events defined in this extension.
|
||||
*/
|
||||
#define DO_SWAP(func,type) func ((type *)from, (type *)to)
|
||||
|
||||
void
|
||||
SEventIDispatch(xEvent * from, xEvent * to)
|
||||
{
|
||||
int type = from->u.u.type & 0177;
|
||||
|
||||
if (type == DeviceValuator)
|
||||
DO_SWAP(SEventDeviceValuator, deviceValuator);
|
||||
else if (type == DeviceKeyPress) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceKeyRelease) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceButtonPress) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceButtonRelease) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceMotionNotify) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceFocusIn)
|
||||
DO_SWAP(SEventFocus, deviceFocus);
|
||||
else if (type == DeviceFocusOut)
|
||||
DO_SWAP(SEventFocus, deviceFocus);
|
||||
else if (type == ProximityIn) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == ProximityOut) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceStateNotify)
|
||||
DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
|
||||
else if (type == DeviceKeyStateNotify)
|
||||
DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
|
||||
else if (type == DeviceButtonStateNotify)
|
||||
DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
|
||||
else if (type == DeviceMappingNotify)
|
||||
DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
|
||||
else if (type == ChangeDeviceNotify)
|
||||
DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
|
||||
else {
|
||||
FatalError("XInputExtension: Impossible event!\n");
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* This function swaps the DeviceValuator event.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
|
||||
{
|
||||
register char n;
|
||||
|
@ -577,7 +477,7 @@ SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SEventFocus(deviceFocus * from, deviceFocus * to)
|
||||
{
|
||||
register char n;
|
||||
|
@ -588,7 +488,7 @@ SEventFocus(deviceFocus * from, deviceFocus * to)
|
|||
swapl(&to->window, n);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
|
||||
{
|
||||
register int i;
|
||||
|
@ -604,7 +504,7 @@ SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
|
||||
deviceKeyStateNotify * to)
|
||||
{
|
||||
|
@ -614,7 +514,7 @@ SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
|
|||
swaps(&to->sequenceNumber, n);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from,
|
||||
deviceButtonStateNotify * to)
|
||||
{
|
||||
|
@ -624,7 +524,7 @@ SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from,
|
|||
swaps(&to->sequenceNumber, n);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to)
|
||||
{
|
||||
register char n;
|
||||
|
@ -634,7 +534,7 @@ SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to)
|
|||
swapl(&to->time, n);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
|
||||
{
|
||||
register char n;
|
||||
|
@ -644,7 +544,7 @@ SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
|
|||
swapl(&to->time, n);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
|
||||
{
|
||||
register char n;
|
||||
|
@ -655,13 +555,106 @@ SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to
|
|||
swaps(&to->control, n);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Allow the specified event to have its propagation suppressed.
|
||||
* The default is to not allow suppression of propagation.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
AllowPropagateSuppress(Mask mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_DEVICES; i++)
|
||||
PropagateMask[i] |= mask;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Return the next available extension event mask.
|
||||
*
|
||||
*/
|
||||
|
||||
static Mask
|
||||
GetNextExtEventMask(void)
|
||||
{
|
||||
int i;
|
||||
Mask mask = lastExtEventMask;
|
||||
|
||||
if (lastExtEventMask == 0) {
|
||||
FatalError("GetNextExtEventMask: no more events are available.");
|
||||
}
|
||||
lastExtEventMask <<= 1;
|
||||
|
||||
for (i = 0; i < MAX_DEVICES; i++)
|
||||
ExtValidMasks[i] |= mask;
|
||||
return mask;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Record an event mask where there is no unique corresponding event type.
|
||||
* We can't call SetMaskForEvent, since that would clobber the existing
|
||||
* mask for that event. MotionHint and ButtonMotion are examples.
|
||||
*
|
||||
* Since extension event types will never be less than 64, we can use
|
||||
* 0-63 in the EventInfo array as the "type" to be used to look up this
|
||||
* mask. This means that the corresponding macros such as
|
||||
* DevicePointerMotionHint must have access to the same constants.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
SetEventInfo(Mask mask, int constant)
|
||||
{
|
||||
EventInfo[ExtEventIndex].mask = mask;
|
||||
EventInfo[ExtEventIndex++].type = constant;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Allow the specified event to be restricted to being selected by one
|
||||
* client at a time.
|
||||
* The default is to allow more than one client to select the event.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
SetExclusiveAccess(Mask mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_DEVICES; i++)
|
||||
ExtExclusiveMasks[i] |= mask;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Assign the specified mask to the specified event.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
SetMaskForExtEvent(Mask mask, int event)
|
||||
{
|
||||
|
||||
EventInfo[ExtEventIndex].mask = mask;
|
||||
EventInfo[ExtEventIndex++].type = event;
|
||||
|
||||
if ((event < LASTEvent) || (event >= 128))
|
||||
FatalError("MaskForExtensionEvent: bogus event number");
|
||||
SetMaskForEvent(mask, event);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* This function sets up extension event types and masks.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
FixExtensionEvents(ExtensionEntry * extEntry)
|
||||
{
|
||||
Mask mask;
|
||||
|
@ -767,7 +760,7 @@ FixExtensionEvents(ExtensionEntry * extEntry)
|
|||
*
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
RestoreExtensionEvents(void)
|
||||
{
|
||||
int i;
|
||||
|
@ -815,7 +808,7 @@ RestoreExtensionEvents(void)
|
|||
*
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
IResetProc(ExtensionEntry * unused)
|
||||
{
|
||||
|
||||
|
@ -859,7 +852,7 @@ AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
|
|||
*
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
MakeDeviceTypeAtoms(void)
|
||||
{
|
||||
int i;
|
||||
|
@ -892,95 +885,102 @@ LookupDeviceIntRec(CARD8 id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Allow the specified event to be restricted to being selected by one
|
||||
* client at a time.
|
||||
* The default is to allow more than one client to select the event.
|
||||
* SEventIDispatch
|
||||
*
|
||||
* Swap any events defined in this extension.
|
||||
*/
|
||||
#define DO_SWAP(func,type) func ((type *)from, (type *)to)
|
||||
|
||||
void
|
||||
SetExclusiveAccess(Mask mask)
|
||||
static void
|
||||
SEventIDispatch(xEvent * from, xEvent * to)
|
||||
{
|
||||
int i;
|
||||
int type = from->u.u.type & 0177;
|
||||
|
||||
for (i = 0; i < MAX_DEVICES; i++)
|
||||
ExtExclusiveMasks[i] |= mask;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Allow the specified event to have its propagation suppressed.
|
||||
* The default is to not allow suppression of propagation.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
AllowPropagateSuppress(Mask mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_DEVICES; i++)
|
||||
PropagateMask[i] |= mask;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Return the next available extension event mask.
|
||||
*
|
||||
*/
|
||||
|
||||
Mask
|
||||
GetNextExtEventMask(void)
|
||||
{
|
||||
int i;
|
||||
Mask mask = lastExtEventMask;
|
||||
|
||||
if (lastExtEventMask == 0) {
|
||||
FatalError("GetNextExtEventMask: no more events are available.");
|
||||
if (type == DeviceValuator)
|
||||
DO_SWAP(SEventDeviceValuator, deviceValuator);
|
||||
else if (type == DeviceKeyPress) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceKeyRelease) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceButtonPress) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceButtonRelease) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceMotionNotify) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceFocusIn)
|
||||
DO_SWAP(SEventFocus, deviceFocus);
|
||||
else if (type == DeviceFocusOut)
|
||||
DO_SWAP(SEventFocus, deviceFocus);
|
||||
else if (type == ProximityIn) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == ProximityOut) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceStateNotify)
|
||||
DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
|
||||
else if (type == DeviceKeyStateNotify)
|
||||
DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
|
||||
else if (type == DeviceButtonStateNotify)
|
||||
DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
|
||||
else if (type == DeviceMappingNotify)
|
||||
DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
|
||||
else if (type == ChangeDeviceNotify)
|
||||
DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
|
||||
else {
|
||||
FatalError("XInputExtension: Impossible event!\n");
|
||||
}
|
||||
lastExtEventMask <<= 1;
|
||||
|
||||
for (i = 0; i < MAX_DEVICES; i++)
|
||||
ExtValidMasks[i] |= mask;
|
||||
return mask;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
/**********************************************************************
|
||||
*
|
||||
* Assign the specified mask to the specified event.
|
||||
* IExtensionInit - initialize the input extension.
|
||||
*
|
||||
* Called from InitExtensions in main() or from QueryExtension() if the
|
||||
* extension is dynamically loaded.
|
||||
*
|
||||
* This extension has several events and errors.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SetMaskForExtEvent(Mask mask, int event)
|
||||
XInputExtensionInit(void)
|
||||
{
|
||||
ExtensionEntry *extEntry;
|
||||
|
||||
EventInfo[ExtEventIndex].mask = mask;
|
||||
EventInfo[ExtEventIndex++].type = event;
|
||||
|
||||
if ((event < LASTEvent) || (event >= 128))
|
||||
FatalError("MaskForExtensionEvent: bogus event number");
|
||||
SetMaskForEvent(mask, event);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Record an event mask where there is no unique corresponding event type.
|
||||
* We can't call SetMaskForEvent, since that would clobber the existing
|
||||
* mask for that event. MotionHint and ButtonMotion are examples.
|
||||
*
|
||||
* Since extension event types will never be less than 64, we can use
|
||||
* 0-63 in the EventInfo array as the "type" to be used to look up this
|
||||
* mask. This means that the corresponding macros such as
|
||||
* DevicePointerMotionHint must have access to the same constants.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SetEventInfo(Mask mask, int constant)
|
||||
{
|
||||
EventInfo[ExtEventIndex].mask = mask;
|
||||
EventInfo[ExtEventIndex++].type = constant;
|
||||
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
|
||||
SProcIDispatch, IResetProc, StandardMinorOpcode);
|
||||
if (extEntry) {
|
||||
IReqCode = extEntry->base;
|
||||
AllExtensionVersions[IReqCode - 128] = thisversion;
|
||||
MakeDeviceTypeAtoms();
|
||||
RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone);
|
||||
FixExtensionEvents(extEntry);
|
||||
ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
|
||||
EventSwapVector[DeviceValuator] = SEventIDispatch;
|
||||
EventSwapVector[DeviceKeyPress] = SEventIDispatch;
|
||||
EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
|
||||
EventSwapVector[DeviceButtonPress] = SEventIDispatch;
|
||||
EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
|
||||
EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceFocusIn] = SEventIDispatch;
|
||||
EventSwapVector[DeviceFocusOut] = SEventIDispatch;
|
||||
EventSwapVector[ProximityIn] = SEventIDispatch;
|
||||
EventSwapVector[ProximityOut] = SEventIDispatch;
|
||||
EventSwapVector[DeviceStateNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
|
||||
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
|
||||
} else {
|
||||
FatalError("IExtensionInit: AddExtensions failed\n");
|
||||
}
|
||||
}
|
||||
|
|
293
Xi/getdctl.c
293
Xi/getdctl.c
|
@ -86,6 +86,152 @@ SProcXGetDeviceControl(register ClientPtr client)
|
|||
return (ProcXGetDeviceControl(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies DeviceResolution data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
|
||||
int length)
|
||||
{
|
||||
register char n;
|
||||
AxisInfoPtr a;
|
||||
xDeviceResolutionState *r;
|
||||
int i, *iptr;
|
||||
|
||||
r = (xDeviceResolutionState *) buf;
|
||||
r->control = DEVICE_RESOLUTION;
|
||||
r->length = length;
|
||||
r->num_valuators = v->numAxes;
|
||||
buf += sizeof(xDeviceResolutionState);
|
||||
iptr = (int *)buf;
|
||||
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
|
||||
*iptr++ = a->resolution;
|
||||
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
|
||||
*iptr++ = a->min_resolution;
|
||||
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
|
||||
*iptr++ = a->max_resolution;
|
||||
if (client->swapped) {
|
||||
swaps(&r->control, n);
|
||||
swaps(&r->length, n);
|
||||
swapl(&r->num_valuators, n);
|
||||
iptr = (int *)buf;
|
||||
for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
|
||||
swapl(iptr, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
|
||||
char *buf)
|
||||
{
|
||||
register char n;
|
||||
xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf;
|
||||
|
||||
calib->control = DEVICE_ABS_CALIB;
|
||||
calib->length = sizeof(calib);
|
||||
calib->min_x = dts->min_x;
|
||||
calib->max_x = dts->max_x;
|
||||
calib->min_y = dts->min_y;
|
||||
calib->max_y = dts->max_y;
|
||||
calib->flip_x = dts->flip_x;
|
||||
calib->flip_y = dts->flip_y;
|
||||
calib->rotation = dts->rotation;
|
||||
calib->button_threshold = dts->button_threshold;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&calib->control, n);
|
||||
swaps(&calib->length, n);
|
||||
swapl(&calib->min_x, n);
|
||||
swapl(&calib->max_x, n);
|
||||
swapl(&calib->min_y, n);
|
||||
swapl(&calib->max_y, n);
|
||||
swapl(&calib->flip_x, n);
|
||||
swapl(&calib->flip_y, n);
|
||||
swapl(&calib->rotation, n);
|
||||
swapl(&calib->button_threshold, n);
|
||||
}
|
||||
}
|
||||
|
||||
static void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
|
||||
char *buf)
|
||||
{
|
||||
register char n;
|
||||
xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf;
|
||||
|
||||
area->control = DEVICE_ABS_AREA;
|
||||
area->length = sizeof(area);
|
||||
area->offset_x = dts->offset_x;
|
||||
area->offset_y = dts->offset_y;
|
||||
area->width = dts->width;
|
||||
area->height = dts->height;
|
||||
area->screen = dts->screen;
|
||||
area->following = dts->following;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&area->control, n);
|
||||
swaps(&area->length, n);
|
||||
swapl(&area->offset_x, n);
|
||||
swapl(&area->offset_y, n);
|
||||
swapl(&area->width, n);
|
||||
swapl(&area->height, n);
|
||||
swapl(&area->screen, n);
|
||||
swapl(&area->following, n);
|
||||
}
|
||||
}
|
||||
|
||||
static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||
{
|
||||
register char n;
|
||||
xDeviceCoreState *c = (xDeviceCoreState *) buf;
|
||||
|
||||
c->control = DEVICE_CORE;
|
||||
c->length = sizeof(c);
|
||||
c->status = dev->coreEvents;
|
||||
c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&c->control, n);
|
||||
swaps(&c->length, n);
|
||||
swaps(&c->status, n);
|
||||
}
|
||||
}
|
||||
|
||||
static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||
{
|
||||
register char n;
|
||||
xDeviceEnableState *e = (xDeviceEnableState *) buf;
|
||||
|
||||
e->control = DEVICE_ENABLE;
|
||||
e->length = sizeof(e);
|
||||
e->enable = dev->enabled;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&e->control, n);
|
||||
swaps(&e->length, n);
|
||||
swaps(&e->enable, n);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the xGetDeviceControl function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Get the state of the specified device control.
|
||||
|
@ -186,150 +332,3 @@ ProcXGetDeviceControl(ClientPtr client)
|
|||
xfree(savbuf);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies DeviceResolution data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
|
||||
int length)
|
||||
{
|
||||
register char n;
|
||||
AxisInfoPtr a;
|
||||
xDeviceResolutionState *r;
|
||||
int i, *iptr;
|
||||
|
||||
r = (xDeviceResolutionState *) buf;
|
||||
r->control = DEVICE_RESOLUTION;
|
||||
r->length = length;
|
||||
r->num_valuators = v->numAxes;
|
||||
buf += sizeof(xDeviceResolutionState);
|
||||
iptr = (int *)buf;
|
||||
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
|
||||
*iptr++ = a->resolution;
|
||||
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
|
||||
*iptr++ = a->min_resolution;
|
||||
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
|
||||
*iptr++ = a->max_resolution;
|
||||
if (client->swapped) {
|
||||
swaps(&r->control, n);
|
||||
swaps(&r->length, n);
|
||||
swapl(&r->num_valuators, n);
|
||||
iptr = (int *)buf;
|
||||
for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
|
||||
swapl(iptr, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
|
||||
char *buf)
|
||||
{
|
||||
register char n;
|
||||
xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf;
|
||||
|
||||
calib->control = DEVICE_ABS_CALIB;
|
||||
calib->length = sizeof(calib);
|
||||
calib->min_x = dts->min_x;
|
||||
calib->max_x = dts->max_x;
|
||||
calib->min_y = dts->min_y;
|
||||
calib->max_y = dts->max_y;
|
||||
calib->flip_x = dts->flip_x;
|
||||
calib->flip_y = dts->flip_y;
|
||||
calib->rotation = dts->rotation;
|
||||
calib->button_threshold = dts->button_threshold;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&calib->control, n);
|
||||
swaps(&calib->length, n);
|
||||
swapl(&calib->min_x, n);
|
||||
swapl(&calib->max_x, n);
|
||||
swapl(&calib->min_y, n);
|
||||
swapl(&calib->max_y, n);
|
||||
swapl(&calib->flip_x, n);
|
||||
swapl(&calib->flip_y, n);
|
||||
swapl(&calib->rotation, n);
|
||||
swapl(&calib->button_threshold, n);
|
||||
}
|
||||
}
|
||||
|
||||
void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
|
||||
char *buf)
|
||||
{
|
||||
register char n;
|
||||
xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf;
|
||||
|
||||
area->control = DEVICE_ABS_AREA;
|
||||
area->length = sizeof(area);
|
||||
area->offset_x = dts->offset_x;
|
||||
area->offset_y = dts->offset_y;
|
||||
area->width = dts->width;
|
||||
area->height = dts->height;
|
||||
area->screen = dts->screen;
|
||||
area->following = dts->following;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&area->control, n);
|
||||
swaps(&area->length, n);
|
||||
swapl(&area->offset_x, n);
|
||||
swapl(&area->offset_y, n);
|
||||
swapl(&area->width, n);
|
||||
swapl(&area->height, n);
|
||||
swapl(&area->screen, n);
|
||||
swapl(&area->following, n);
|
||||
}
|
||||
}
|
||||
|
||||
void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||
{
|
||||
register char n;
|
||||
xDeviceCoreState *c = (xDeviceCoreState *) buf;
|
||||
|
||||
c->control = DEVICE_CORE;
|
||||
c->length = sizeof(c);
|
||||
c->status = dev->coreEvents;
|
||||
c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&c->control, n);
|
||||
swaps(&c->length, n);
|
||||
swaps(&c->status, n);
|
||||
}
|
||||
}
|
||||
|
||||
void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||
{
|
||||
register char n;
|
||||
xDeviceEnableState *e = (xDeviceEnableState *) buf;
|
||||
|
||||
e->control = DEVICE_ENABLE;
|
||||
e->length = sizeof(e);
|
||||
e->enable = dev->enabled;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&e->control, n);
|
||||
swaps(&e->length, n);
|
||||
swaps(&e->enable, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the xGetDeviceControl function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
|
24
Xi/getdctl.h
24
Xi/getdctl.h
|
@ -36,30 +36,6 @@ int SProcXGetDeviceControl(ClientPtr /* client */
|
|||
int ProcXGetDeviceControl(ClientPtr /* client */
|
||||
);
|
||||
|
||||
void CopySwapDeviceResolution(ClientPtr /* client */ ,
|
||||
ValuatorClassPtr /* v */ ,
|
||||
char * /* buf */ ,
|
||||
int /* length */
|
||||
);
|
||||
|
||||
void CopySwapDeviceAbsCalib (ClientPtr client,
|
||||
AbsoluteClassPtr dts,
|
||||
char *buf);
|
||||
|
||||
void CopySwapDeviceAbsArea (ClientPtr client,
|
||||
AbsoluteClassPtr dts,
|
||||
char *buf);
|
||||
|
||||
void CopySwapDeviceCore(ClientPtr /* client */ ,
|
||||
DeviceIntPtr /* dev */ ,
|
||||
char * /* buf */
|
||||
);
|
||||
|
||||
void CopySwapDeviceEnable(ClientPtr /* client */ ,
|
||||
DeviceIntPtr /* dev */ ,
|
||||
char * /* buf */
|
||||
);
|
||||
|
||||
void SRepXGetDeviceControl(ClientPtr /* client */ ,
|
||||
int /* size */ ,
|
||||
xGetDeviceControlReply * /* rep */
|
||||
|
|
400
Xi/getfctl.c
400
Xi/getfctl.c
|
@ -84,6 +84,206 @@ SProcXGetFeedbackControl(register ClientPtr client)
|
|||
return (ProcXGetFeedbackControl(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies KbdFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
|
||||
{
|
||||
int i;
|
||||
register char n;
|
||||
xKbdFeedbackState *k2;
|
||||
|
||||
k2 = (xKbdFeedbackState *) * buf;
|
||||
k2->class = KbdFeedbackClass;
|
||||
k2->length = sizeof(xKbdFeedbackState);
|
||||
k2->id = k->ctrl.id;
|
||||
k2->click = k->ctrl.click;
|
||||
k2->percent = k->ctrl.bell;
|
||||
k2->pitch = k->ctrl.bell_pitch;
|
||||
k2->duration = k->ctrl.bell_duration;
|
||||
k2->led_mask = k->ctrl.leds;
|
||||
k2->global_auto_repeat = k->ctrl.autoRepeat;
|
||||
for (i = 0; i < 32; i++)
|
||||
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
|
||||
if (client->swapped) {
|
||||
swaps(&k2->length, n);
|
||||
swaps(&k2->pitch, n);
|
||||
swaps(&k2->duration, n);
|
||||
swapl(&k2->led_mask, n);
|
||||
swapl(&k2->led_values, n);
|
||||
}
|
||||
*buf += sizeof(xKbdFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies PtrFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xPtrFeedbackState *p2;
|
||||
|
||||
p2 = (xPtrFeedbackState *) * buf;
|
||||
p2->class = PtrFeedbackClass;
|
||||
p2->length = sizeof(xPtrFeedbackState);
|
||||
p2->id = p->ctrl.id;
|
||||
p2->accelNum = p->ctrl.num;
|
||||
p2->accelDenom = p->ctrl.den;
|
||||
p2->threshold = p->ctrl.threshold;
|
||||
if (client->swapped) {
|
||||
swaps(&p2->length, n);
|
||||
swaps(&p2->accelNum, n);
|
||||
swaps(&p2->accelDenom, n);
|
||||
swaps(&p2->threshold, n);
|
||||
}
|
||||
*buf += sizeof(xPtrFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies IntegerFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xIntegerFeedbackState *i2;
|
||||
|
||||
i2 = (xIntegerFeedbackState *) * buf;
|
||||
i2->class = IntegerFeedbackClass;
|
||||
i2->length = sizeof(xIntegerFeedbackState);
|
||||
i2->id = i->ctrl.id;
|
||||
i2->resolution = i->ctrl.resolution;
|
||||
i2->min_value = i->ctrl.min_value;
|
||||
i2->max_value = i->ctrl.max_value;
|
||||
if (client->swapped) {
|
||||
swaps(&i2->length, n);
|
||||
swapl(&i2->resolution, n);
|
||||
swapl(&i2->min_value, n);
|
||||
swapl(&i2->max_value, n);
|
||||
}
|
||||
*buf += sizeof(xIntegerFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies StringFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf)
|
||||
{
|
||||
int i;
|
||||
register char n;
|
||||
xStringFeedbackState *s2;
|
||||
KeySym *kptr;
|
||||
|
||||
s2 = (xStringFeedbackState *) * buf;
|
||||
s2->class = StringFeedbackClass;
|
||||
s2->length = sizeof(xStringFeedbackState) +
|
||||
s->ctrl.num_symbols_supported * sizeof(KeySym);
|
||||
s2->id = s->ctrl.id;
|
||||
s2->max_symbols = s->ctrl.max_symbols;
|
||||
s2->num_syms_supported = s->ctrl.num_symbols_supported;
|
||||
*buf += sizeof(xStringFeedbackState);
|
||||
kptr = (KeySym *) (*buf);
|
||||
for (i = 0; i < s->ctrl.num_symbols_supported; i++)
|
||||
*kptr++ = *(s->ctrl.symbols_supported + i);
|
||||
if (client->swapped) {
|
||||
swaps(&s2->length, n);
|
||||
swaps(&s2->max_symbols, n);
|
||||
swaps(&s2->num_syms_supported, n);
|
||||
kptr = (KeySym *) (*buf);
|
||||
for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) {
|
||||
swapl(kptr, n);
|
||||
}
|
||||
}
|
||||
*buf += (s->ctrl.num_symbols_supported * sizeof(KeySym));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies LedFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xLedFeedbackState *l2;
|
||||
|
||||
l2 = (xLedFeedbackState *) * buf;
|
||||
l2->class = LedFeedbackClass;
|
||||
l2->length = sizeof(xLedFeedbackState);
|
||||
l2->id = l->ctrl.id;
|
||||
l2->led_values = l->ctrl.led_values;
|
||||
l2->led_mask = l->ctrl.led_mask;
|
||||
if (client->swapped) {
|
||||
swaps(&l2->length, n);
|
||||
swapl(&l2->led_values, n);
|
||||
swapl(&l2->led_mask, n);
|
||||
}
|
||||
*buf += sizeof(xLedFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies BellFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xBellFeedbackState *b2;
|
||||
|
||||
b2 = (xBellFeedbackState *) * buf;
|
||||
b2->class = BellFeedbackClass;
|
||||
b2->length = sizeof(xBellFeedbackState);
|
||||
b2->id = b->ctrl.id;
|
||||
b2->percent = b->ctrl.percent;
|
||||
b2->pitch = b->ctrl.pitch;
|
||||
b2->duration = b->ctrl.duration;
|
||||
if (client->swapped) {
|
||||
swaps(&b2->length, n);
|
||||
swaps(&b2->pitch, n);
|
||||
swaps(&b2->duration, n);
|
||||
}
|
||||
*buf += sizeof(xBellFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the xGetFeedbackControl function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SRepXGetFeedbackControl(ClientPtr client, int size,
|
||||
xGetFeedbackControlReply * rep)
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
swaps(&rep->num_feedbacks, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Get the feedback control state.
|
||||
|
@ -176,203 +376,3 @@ ProcXGetFeedbackControl(ClientPtr client)
|
|||
xfree(savbuf);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies KbdFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
|
||||
{
|
||||
int i;
|
||||
register char n;
|
||||
xKbdFeedbackState *k2;
|
||||
|
||||
k2 = (xKbdFeedbackState *) * buf;
|
||||
k2->class = KbdFeedbackClass;
|
||||
k2->length = sizeof(xKbdFeedbackState);
|
||||
k2->id = k->ctrl.id;
|
||||
k2->click = k->ctrl.click;
|
||||
k2->percent = k->ctrl.bell;
|
||||
k2->pitch = k->ctrl.bell_pitch;
|
||||
k2->duration = k->ctrl.bell_duration;
|
||||
k2->led_mask = k->ctrl.leds;
|
||||
k2->global_auto_repeat = k->ctrl.autoRepeat;
|
||||
for (i = 0; i < 32; i++)
|
||||
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
|
||||
if (client->swapped) {
|
||||
swaps(&k2->length, n);
|
||||
swaps(&k2->pitch, n);
|
||||
swaps(&k2->duration, n);
|
||||
swapl(&k2->led_mask, n);
|
||||
swapl(&k2->led_values, n);
|
||||
}
|
||||
*buf += sizeof(xKbdFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies PtrFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xPtrFeedbackState *p2;
|
||||
|
||||
p2 = (xPtrFeedbackState *) * buf;
|
||||
p2->class = PtrFeedbackClass;
|
||||
p2->length = sizeof(xPtrFeedbackState);
|
||||
p2->id = p->ctrl.id;
|
||||
p2->accelNum = p->ctrl.num;
|
||||
p2->accelDenom = p->ctrl.den;
|
||||
p2->threshold = p->ctrl.threshold;
|
||||
if (client->swapped) {
|
||||
swaps(&p2->length, n);
|
||||
swaps(&p2->accelNum, n);
|
||||
swaps(&p2->accelDenom, n);
|
||||
swaps(&p2->threshold, n);
|
||||
}
|
||||
*buf += sizeof(xPtrFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies IntegerFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xIntegerFeedbackState *i2;
|
||||
|
||||
i2 = (xIntegerFeedbackState *) * buf;
|
||||
i2->class = IntegerFeedbackClass;
|
||||
i2->length = sizeof(xIntegerFeedbackState);
|
||||
i2->id = i->ctrl.id;
|
||||
i2->resolution = i->ctrl.resolution;
|
||||
i2->min_value = i->ctrl.min_value;
|
||||
i2->max_value = i->ctrl.max_value;
|
||||
if (client->swapped) {
|
||||
swaps(&i2->length, n);
|
||||
swapl(&i2->resolution, n);
|
||||
swapl(&i2->min_value, n);
|
||||
swapl(&i2->max_value, n);
|
||||
}
|
||||
*buf += sizeof(xIntegerFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies StringFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf)
|
||||
{
|
||||
int i;
|
||||
register char n;
|
||||
xStringFeedbackState *s2;
|
||||
KeySym *kptr;
|
||||
|
||||
s2 = (xStringFeedbackState *) * buf;
|
||||
s2->class = StringFeedbackClass;
|
||||
s2->length = sizeof(xStringFeedbackState) +
|
||||
s->ctrl.num_symbols_supported * sizeof(KeySym);
|
||||
s2->id = s->ctrl.id;
|
||||
s2->max_symbols = s->ctrl.max_symbols;
|
||||
s2->num_syms_supported = s->ctrl.num_symbols_supported;
|
||||
*buf += sizeof(xStringFeedbackState);
|
||||
kptr = (KeySym *) (*buf);
|
||||
for (i = 0; i < s->ctrl.num_symbols_supported; i++)
|
||||
*kptr++ = *(s->ctrl.symbols_supported + i);
|
||||
if (client->swapped) {
|
||||
swaps(&s2->length, n);
|
||||
swaps(&s2->max_symbols, n);
|
||||
swaps(&s2->num_syms_supported, n);
|
||||
kptr = (KeySym *) (*buf);
|
||||
for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) {
|
||||
swapl(kptr, n);
|
||||
}
|
||||
}
|
||||
*buf += (s->ctrl.num_symbols_supported * sizeof(KeySym));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies LedFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xLedFeedbackState *l2;
|
||||
|
||||
l2 = (xLedFeedbackState *) * buf;
|
||||
l2->class = LedFeedbackClass;
|
||||
l2->length = sizeof(xLedFeedbackState);
|
||||
l2->id = l->ctrl.id;
|
||||
l2->led_values = l->ctrl.led_values;
|
||||
l2->led_mask = l->ctrl.led_mask;
|
||||
if (client->swapped) {
|
||||
swaps(&l2->length, n);
|
||||
swapl(&l2->led_values, n);
|
||||
swapl(&l2->led_mask, n);
|
||||
}
|
||||
*buf += sizeof(xLedFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies BellFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xBellFeedbackState *b2;
|
||||
|
||||
b2 = (xBellFeedbackState *) * buf;
|
||||
b2->class = BellFeedbackClass;
|
||||
b2->length = sizeof(xBellFeedbackState);
|
||||
b2->id = b->ctrl.id;
|
||||
b2->percent = b->ctrl.percent;
|
||||
b2->pitch = b->ctrl.pitch;
|
||||
b2->duration = b->ctrl.duration;
|
||||
if (client->swapped) {
|
||||
swaps(&b2->length, n);
|
||||
swaps(&b2->pitch, n);
|
||||
swaps(&b2->duration, n);
|
||||
}
|
||||
*buf += sizeof(xBellFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the xGetFeedbackControl function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SRepXGetFeedbackControl(ClientPtr client, int size,
|
||||
xGetFeedbackControlReply * rep)
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
swaps(&rep->num_feedbacks, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
|
30
Xi/getfctl.h
30
Xi/getfctl.h
|
@ -36,36 +36,6 @@ int SProcXGetFeedbackControl(ClientPtr /* client */
|
|||
int ProcXGetFeedbackControl(ClientPtr /* client */
|
||||
);
|
||||
|
||||
void CopySwapKbdFeedback(ClientPtr /* client */ ,
|
||||
KbdFeedbackPtr /* k */ ,
|
||||
char ** /* buf */
|
||||
);
|
||||
|
||||
void CopySwapPtrFeedback(ClientPtr /* client */ ,
|
||||
PtrFeedbackPtr /* p */ ,
|
||||
char ** /* buf */
|
||||
);
|
||||
|
||||
void CopySwapIntegerFeedback(ClientPtr /* client */ ,
|
||||
IntegerFeedbackPtr /* i */ ,
|
||||
char ** /* buf */
|
||||
);
|
||||
|
||||
void CopySwapStringFeedback(ClientPtr /* client */ ,
|
||||
StringFeedbackPtr /* s */ ,
|
||||
char ** /* buf */
|
||||
);
|
||||
|
||||
void CopySwapLedFeedback(ClientPtr /* client */ ,
|
||||
LedFeedbackPtr /* l */ ,
|
||||
char ** /* buf */
|
||||
);
|
||||
|
||||
void CopySwapBellFeedback(ClientPtr /* client */ ,
|
||||
BellFeedbackPtr /* b */ ,
|
||||
char ** /* buf */
|
||||
);
|
||||
|
||||
void SRepXGetFeedbackControl(ClientPtr /* client */ ,
|
||||
int /* size */ ,
|
||||
xGetFeedbackControlReply * /* rep */
|
||||
|
|
424
Xi/listdev.c
424
Xi/listdev.c
|
@ -86,6 +86,218 @@ SProcXListInputDevices(register ClientPtr client)
|
|||
return (ProcXListInputDevices(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure calculates the size of the information to be returned
|
||||
* for an input device.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
|
||||
{
|
||||
int chunks;
|
||||
|
||||
*namesize += 1;
|
||||
if (d->name)
|
||||
*namesize += strlen(d->name);
|
||||
if (d->key != NULL)
|
||||
*size += sizeof(xKeyInfo);
|
||||
if (d->button != NULL)
|
||||
*size += sizeof(xButtonInfo);
|
||||
if (d->valuator != NULL) {
|
||||
chunks = ((int)d->valuator->numAxes + 19) / VPC;
|
||||
*size += (chunks * sizeof(xValuatorInfo) +
|
||||
d->valuator->numAxes * sizeof(xAxisInfo));
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies data to the DeviceInfo struct, swapping if necessary.
|
||||
*
|
||||
* We need the extra byte in the allocated buffer, because the trailing null
|
||||
* hammers one extra byte, which is overwritten by the next name except for
|
||||
* the last name copied.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
CopyDeviceName(char **namebuf, char *name)
|
||||
{
|
||||
char *nameptr = (char *)*namebuf;
|
||||
|
||||
if (name) {
|
||||
*nameptr++ = strlen(name);
|
||||
strcpy(nameptr, name);
|
||||
*namebuf += (strlen(name) + 1);
|
||||
} else {
|
||||
*nameptr++ = 0;
|
||||
*namebuf += 1;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies ButtonClass information, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xButtonInfoPtr b2;
|
||||
|
||||
b2 = (xButtonInfoPtr) * buf;
|
||||
b2->class = ButtonClass;
|
||||
b2->length = sizeof(xButtonInfo);
|
||||
b2->num_buttons = b->numButtons;
|
||||
if (client->swapped) {
|
||||
swaps(&b2->num_buttons, n); /* macro - braces are required */
|
||||
}
|
||||
*buf += sizeof(xButtonInfo);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies data to the DeviceInfo struct, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes,
|
||||
char **buf)
|
||||
{
|
||||
register char n;
|
||||
xDeviceInfoPtr dev;
|
||||
|
||||
dev = (xDeviceInfoPtr) * buf;
|
||||
|
||||
dev->id = d->id;
|
||||
dev->type = d->type;
|
||||
dev->num_classes = num_classes;
|
||||
if (d == inputInfo.keyboard)
|
||||
dev->use = IsXKeyboard;
|
||||
else if (d == inputInfo.pointer)
|
||||
dev->use = IsXPointer;
|
||||
else if (d->key && d->kbdfeed)
|
||||
dev->use = IsXExtensionKeyboard;
|
||||
else if (d->valuator && d->button)
|
||||
dev->use = IsXExtensionPointer;
|
||||
else
|
||||
dev->use = IsXExtensionDevice;
|
||||
if (client->swapped) {
|
||||
swapl(&dev->type, n); /* macro - braces are required */
|
||||
}
|
||||
*buf += sizeof(xDeviceInfo);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies KeyClass information, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xKeyInfoPtr k2;
|
||||
|
||||
k2 = (xKeyInfoPtr) * buf;
|
||||
k2->class = KeyClass;
|
||||
k2->length = sizeof(xKeyInfo);
|
||||
k2->min_keycode = k->curKeySyms.minKeyCode;
|
||||
k2->max_keycode = k->curKeySyms.maxKeyCode;
|
||||
k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
|
||||
if (client->swapped) {
|
||||
swaps(&k2->num_keys, n);
|
||||
}
|
||||
*buf += sizeof(xKeyInfo);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies ValuatorClass information, swapping if necessary.
|
||||
*
|
||||
* Devices may have up to 255 valuators. The length of a ValuatorClass is
|
||||
* defined to be sizeof(ValuatorClassInfo) + num_axes * sizeof (xAxisInfo).
|
||||
* The maximum length is therefore (8 + 255 * 12) = 3068. However, the
|
||||
* length field is one byte. If a device has more than 20 valuators, we
|
||||
* must therefore return multiple valuator classes to the client.
|
||||
*
|
||||
*/
|
||||
|
||||
static int
|
||||
CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf)
|
||||
{
|
||||
int i, j, axes, t_axes;
|
||||
register char n;
|
||||
xValuatorInfoPtr v2;
|
||||
AxisInfo *a;
|
||||
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 = v->mode & DeviceMode;
|
||||
v2->motion_buffer_size = v->numMotionEvents;
|
||||
if (client->swapped) {
|
||||
swapl(&v2->motion_buffer_size, n);
|
||||
}
|
||||
*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->swapped) {
|
||||
swapl(&a2->min_value, n);
|
||||
swapl(&a2->max_value, n);
|
||||
swapl(&a2->resolution, n);
|
||||
}
|
||||
a2++;
|
||||
a++;
|
||||
*buf += sizeof(xAxisInfo);
|
||||
}
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists information to be returned for an input device.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
|
||||
char **devbuf, char **classbuf, char **namebuf)
|
||||
{
|
||||
CopyDeviceName(namebuf, d->name);
|
||||
CopySwapDevice(client, d, 0, devbuf);
|
||||
if (d->key != NULL) {
|
||||
CopySwapKeyClass(client, d->key, classbuf);
|
||||
dev->num_classes++;
|
||||
}
|
||||
if (d->button != NULL) {
|
||||
CopySwapButtonClass(client, d->button, classbuf);
|
||||
dev->num_classes++;
|
||||
}
|
||||
if (d->valuator != NULL) {
|
||||
dev->num_classes +=
|
||||
CopySwapValuatorClass(client, d->valuator, classbuf);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
|
@ -145,218 +357,6 @@ ProcXListInputDevices(register ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure calculates the size of the information to be returned
|
||||
* for an input device.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
|
||||
{
|
||||
int chunks;
|
||||
|
||||
*namesize += 1;
|
||||
if (d->name)
|
||||
*namesize += strlen(d->name);
|
||||
if (d->key != NULL)
|
||||
*size += sizeof(xKeyInfo);
|
||||
if (d->button != NULL)
|
||||
*size += sizeof(xButtonInfo);
|
||||
if (d->valuator != NULL) {
|
||||
chunks = ((int)d->valuator->numAxes + 19) / VPC;
|
||||
*size += (chunks * sizeof(xValuatorInfo) +
|
||||
d->valuator->numAxes * sizeof(xAxisInfo));
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists information to be returned for an input device.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
|
||||
char **devbuf, char **classbuf, char **namebuf)
|
||||
{
|
||||
CopyDeviceName(namebuf, d->name);
|
||||
CopySwapDevice(client, d, 0, devbuf);
|
||||
if (d->key != NULL) {
|
||||
CopySwapKeyClass(client, d->key, classbuf);
|
||||
dev->num_classes++;
|
||||
}
|
||||
if (d->button != NULL) {
|
||||
CopySwapButtonClass(client, d->button, classbuf);
|
||||
dev->num_classes++;
|
||||
}
|
||||
if (d->valuator != NULL) {
|
||||
dev->num_classes +=
|
||||
CopySwapValuatorClass(client, d->valuator, classbuf);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies data to the DeviceInfo struct, swapping if necessary.
|
||||
*
|
||||
* We need the extra byte in the allocated buffer, because the trailing null
|
||||
* hammers one extra byte, which is overwritten by the next name except for
|
||||
* the last name copied.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopyDeviceName(char **namebuf, char *name)
|
||||
{
|
||||
char *nameptr = (char *)*namebuf;
|
||||
|
||||
if (name) {
|
||||
*nameptr++ = strlen(name);
|
||||
strcpy(nameptr, name);
|
||||
*namebuf += (strlen(name) + 1);
|
||||
} else {
|
||||
*nameptr++ = 0;
|
||||
*namebuf += 1;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies data to the DeviceInfo struct, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes,
|
||||
char **buf)
|
||||
{
|
||||
register char n;
|
||||
xDeviceInfoPtr dev;
|
||||
|
||||
dev = (xDeviceInfoPtr) * buf;
|
||||
|
||||
dev->id = d->id;
|
||||
dev->type = d->type;
|
||||
dev->num_classes = num_classes;
|
||||
if (d == inputInfo.keyboard)
|
||||
dev->use = IsXKeyboard;
|
||||
else if (d == inputInfo.pointer)
|
||||
dev->use = IsXPointer;
|
||||
else if (d->key && d->kbdfeed)
|
||||
dev->use = IsXExtensionKeyboard;
|
||||
else if (d->valuator && d->button)
|
||||
dev->use = IsXExtensionPointer;
|
||||
else
|
||||
dev->use = IsXExtensionDevice;
|
||||
if (client->swapped) {
|
||||
swapl(&dev->type, n); /* macro - braces are required */
|
||||
}
|
||||
*buf += sizeof(xDeviceInfo);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies KeyClass information, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xKeyInfoPtr k2;
|
||||
|
||||
k2 = (xKeyInfoPtr) * buf;
|
||||
k2->class = KeyClass;
|
||||
k2->length = sizeof(xKeyInfo);
|
||||
k2->min_keycode = k->curKeySyms.minKeyCode;
|
||||
k2->max_keycode = k->curKeySyms.maxKeyCode;
|
||||
k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
|
||||
if (client->swapped) {
|
||||
swaps(&k2->num_keys, n);
|
||||
}
|
||||
*buf += sizeof(xKeyInfo);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies ButtonClass information, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf)
|
||||
{
|
||||
register char n;
|
||||
xButtonInfoPtr b2;
|
||||
|
||||
b2 = (xButtonInfoPtr) * buf;
|
||||
b2->class = ButtonClass;
|
||||
b2->length = sizeof(xButtonInfo);
|
||||
b2->num_buttons = b->numButtons;
|
||||
if (client->swapped) {
|
||||
swaps(&b2->num_buttons, n); /* macro - braces are required */
|
||||
}
|
||||
*buf += sizeof(xButtonInfo);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies ValuatorClass information, swapping if necessary.
|
||||
*
|
||||
* Devices may have up to 255 valuators. The length of a ValuatorClass is
|
||||
* defined to be sizeof(ValuatorClassInfo) + num_axes * sizeof (xAxisInfo).
|
||||
* The maximum length is therefore (8 + 255 * 12) = 3068. However, the
|
||||
* length field is one byte. If a device has more than 20 valuators, we
|
||||
* must therefore return multiple valuator classes to the client.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf)
|
||||
{
|
||||
int i, j, axes, t_axes;
|
||||
register char n;
|
||||
xValuatorInfoPtr v2;
|
||||
AxisInfo *a;
|
||||
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 = v->mode & DeviceMode;
|
||||
v2->motion_buffer_size = v->numMotionEvents;
|
||||
if (client->swapped) {
|
||||
swapl(&v2->motion_buffer_size, n);
|
||||
}
|
||||
*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->swapped) {
|
||||
swapl(&a2->min_value, n);
|
||||
swapl(&a2->max_value, n);
|
||||
swapl(&a2->resolution, n);
|
||||
}
|
||||
a2++;
|
||||
a++;
|
||||
*buf += sizeof(xAxisInfo);
|
||||
}
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XListInputDevices function,
|
||||
|
|
38
Xi/listdev.h
38
Xi/listdev.h
|
@ -36,44 +36,6 @@ int SProcXListInputDevices(ClientPtr /* client */
|
|||
int ProcXListInputDevices(ClientPtr /* client */
|
||||
);
|
||||
|
||||
void SizeDeviceInfo(DeviceIntPtr /* d */ ,
|
||||
int * /* namesize */ ,
|
||||
int * /* size */
|
||||
);
|
||||
|
||||
void ListDeviceInfo(ClientPtr /* client */ ,
|
||||
DeviceIntPtr /* d */ ,
|
||||
xDeviceInfoPtr /* dev */ ,
|
||||
char ** /* devbuf */ ,
|
||||
char ** /* classbuf */ ,
|
||||
char ** /* namebuf */
|
||||
);
|
||||
|
||||
void CopyDeviceName(char ** /* namebuf */ ,
|
||||
char * /* name */
|
||||
);
|
||||
|
||||
void CopySwapDevice(ClientPtr /* client */ ,
|
||||
DeviceIntPtr /* d */ ,
|
||||
int /* num_classes */ ,
|
||||
char ** /* buf */
|
||||
);
|
||||
|
||||
void CopySwapKeyClass(ClientPtr /* client */ ,
|
||||
KeyClassPtr /* k */ ,
|
||||
char ** /* buf */
|
||||
);
|
||||
|
||||
void CopySwapButtonClass(ClientPtr /* client */ ,
|
||||
ButtonClassPtr /* b */ ,
|
||||
char ** /* buf */
|
||||
);
|
||||
|
||||
int CopySwapValuatorClass(ClientPtr /* client */ ,
|
||||
ValuatorClassPtr /* v */ ,
|
||||
char ** /* buf */
|
||||
);
|
||||
|
||||
void SRepXListInputDevices(ClientPtr /* client */ ,
|
||||
int /* size */ ,
|
||||
xListInputDevicesReply * /* rep */
|
||||
|
|
|
@ -148,10 +148,6 @@ extern void DeleteWindowFromAnyExtEvents(
|
|||
WindowPtr /* pWin */,
|
||||
Bool /* freeResources */);
|
||||
|
||||
extern void DeleteDeviceFromAnyExtEvents(
|
||||
WindowPtr /* pWin */,
|
||||
DeviceIntPtr /* dev */);
|
||||
|
||||
extern int MaybeSendDeviceMotionNotifyHint (
|
||||
deviceKeyButtonPointer * /* pEvents */,
|
||||
Mask /* mask */);
|
||||
|
@ -164,11 +160,6 @@ extern void CheckDeviceGrabAndHintWindow (
|
|||
ClientPtr /* client */,
|
||||
Mask /* deliveryMask */);
|
||||
|
||||
extern Mask DeviceEventMaskForClient(
|
||||
DeviceIntPtr /* dev */,
|
||||
WindowPtr /* pWin */,
|
||||
ClientPtr /* client */);
|
||||
|
||||
extern void MaybeStopDeviceHint(
|
||||
DeviceIntPtr /* dev */,
|
||||
ClientPtr /* client */);
|
||||
|
@ -179,13 +170,6 @@ extern int DeviceEventSuppressForWindow(
|
|||
Mask /* mask */,
|
||||
int /* maskndx */);
|
||||
|
||||
void FindInterestedChildren(
|
||||
DeviceIntPtr /* dev */,
|
||||
WindowPtr /* p1 */,
|
||||
Mask /* mask */,
|
||||
xEvent * /* ev */,
|
||||
int /* count */);
|
||||
|
||||
void SendEventToAllWindows(
|
||||
DeviceIntPtr /* dev */,
|
||||
Mask /* mask */,
|
||||
|
|
|
@ -37,93 +37,6 @@ XInputExtensionInit(
|
|||
void
|
||||
);
|
||||
|
||||
|
||||
int
|
||||
ProcIDispatch (
|
||||
ClientPtr /* client */
|
||||
);
|
||||
|
||||
int
|
||||
SProcIDispatch(
|
||||
ClientPtr /* client */
|
||||
);
|
||||
|
||||
void
|
||||
SReplyIDispatch (
|
||||
ClientPtr /* client */,
|
||||
int /* len */,
|
||||
xGrabDeviceReply * /* rep */
|
||||
);
|
||||
|
||||
void
|
||||
SEventIDispatch (
|
||||
xEvent * /* from */,
|
||||
xEvent * /* to */
|
||||
);
|
||||
|
||||
void
|
||||
SEventDeviceValuator (
|
||||
deviceValuator * /* from */,
|
||||
deviceValuator * /* to */
|
||||
);
|
||||
|
||||
void
|
||||
SEventFocus (
|
||||
deviceFocus * /* from */,
|
||||
deviceFocus * /* to */
|
||||
);
|
||||
|
||||
void
|
||||
SDeviceStateNotifyEvent (
|
||||
deviceStateNotify * /* from */,
|
||||
deviceStateNotify * /* to */
|
||||
);
|
||||
|
||||
void
|
||||
SDeviceKeyStateNotifyEvent (
|
||||
deviceKeyStateNotify * /* from */,
|
||||
deviceKeyStateNotify * /* to */
|
||||
);
|
||||
|
||||
void
|
||||
SDeviceButtonStateNotifyEvent (
|
||||
deviceButtonStateNotify * /* from */,
|
||||
deviceButtonStateNotify * /* to */
|
||||
);
|
||||
|
||||
void
|
||||
SChangeDeviceNotifyEvent (
|
||||
changeDeviceNotify * /* from */,
|
||||
changeDeviceNotify * /* to */
|
||||
);
|
||||
|
||||
void
|
||||
SDeviceMappingNotifyEvent (
|
||||
deviceMappingNotify * /* from */,
|
||||
deviceMappingNotify * /* to */
|
||||
);
|
||||
|
||||
void
|
||||
SDevicePresenceNotifyEvent (
|
||||
devicePresenceNotify * /* from */,
|
||||
devicePresenceNotify * /* to */
|
||||
);
|
||||
|
||||
void
|
||||
FixExtensionEvents (
|
||||
ExtensionEntry * /* extEntry */
|
||||
);
|
||||
|
||||
void
|
||||
RestoreExtensionEvents (
|
||||
void
|
||||
);
|
||||
|
||||
void
|
||||
IResetProc(
|
||||
ExtensionEntry * /* unused */
|
||||
);
|
||||
|
||||
void
|
||||
AssignTypeAndName (
|
||||
DeviceIntPtr /* dev */,
|
||||
|
@ -131,41 +44,9 @@ AssignTypeAndName (
|
|||
char * /* name */
|
||||
);
|
||||
|
||||
void
|
||||
MakeDeviceTypeAtoms (
|
||||
void
|
||||
);
|
||||
|
||||
DeviceIntPtr
|
||||
LookupDeviceIntRec (
|
||||
CARD8 /* id */
|
||||
);
|
||||
|
||||
void
|
||||
SetExclusiveAccess (
|
||||
Mask /* mask */
|
||||
);
|
||||
|
||||
void
|
||||
AllowPropagateSuppress (
|
||||
Mask /* mask */
|
||||
);
|
||||
|
||||
Mask
|
||||
GetNextExtEventMask (
|
||||
void
|
||||
);
|
||||
|
||||
void
|
||||
SetMaskForExtEvent(
|
||||
Mask /* mask */,
|
||||
int /* event */
|
||||
);
|
||||
|
||||
void
|
||||
SetEventInfo(
|
||||
Mask /* mask */,
|
||||
int /* constant */
|
||||
);
|
||||
|
||||
#endif /* EXTINIT_H */
|
||||
|
|
Loading…
Reference in New Issue
Block a user