Xi: adding MPX checks to ProcessOtherEvents
mpx: adding QueryPointer request and reply adjusting names of requests to Xlib compatible naming (xMPX*** instead of mpx***)
This commit is contained in:
parent
416f1bb99a
commit
2a511492f9
22
Changelog
22
Changelog
|
@ -1,4 +1,26 @@
|
||||||
MPX Changelog file
|
MPX Changelog file
|
||||||
|
== 05.12.06 ==
|
||||||
|
Xi: adding MPX checks to ProcessOtherEvents
|
||||||
|
|
||||||
|
mpx: adding QueryPointer request and reply
|
||||||
|
adjusting names of requests to Xlib compatible naming (xMPX*** instead of
|
||||||
|
mpx***)
|
||||||
|
|
||||||
|
|
||||||
|
Files:
|
||||||
|
Xi/exevents.c
|
||||||
|
mpx/Makefile.am
|
||||||
|
mpx/extinit.c
|
||||||
|
mpx/getevbase.c
|
||||||
|
mpx/getvers.c
|
||||||
|
mpx/queryptr.c
|
||||||
|
mpx/queryptr.h
|
||||||
|
mpx/selectev.c
|
||||||
|
mpx/listdev.h
|
||||||
|
mpx/listdev.c
|
||||||
|
include/mpxextinit.h
|
||||||
|
|
||||||
|
|
||||||
== 01.12.06 ==
|
== 01.12.06 ==
|
||||||
|
|
||||||
mpx: SelectEvents and GetEventBase requests.
|
mpx: SelectEvents and GetEventBase requests.
|
||||||
|
|
|
@ -73,6 +73,12 @@ SOFTWARE.
|
||||||
#include "dixgrabs.h" /* CreateGrab() */
|
#include "dixgrabs.h" /* CreateGrab() */
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
|
|
||||||
|
#ifdef MPX
|
||||||
|
#include <X11/extensions/MPXconst.h>
|
||||||
|
#include <X11/extensions/MPXproto.h>
|
||||||
|
#include "mpxglobals.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
|
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
|
||||||
#define AllModifiersMask ( \
|
#define AllModifiersMask ( \
|
||||||
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
|
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
|
||||||
|
@ -230,7 +236,11 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count)
|
||||||
|
|
||||||
if (other->fromPassiveGrab && (key == other->activatingKey))
|
if (other->fromPassiveGrab && (key == other->activatingKey))
|
||||||
deactivateDeviceGrab = TRUE;
|
deactivateDeviceGrab = TRUE;
|
||||||
} else if (xE->u.u.type == DeviceButtonPress) {
|
} else if (xE->u.u.type == DeviceButtonPress
|
||||||
|
#ifdef MPX
|
||||||
|
|| xE->u.u.type == MPXButtonPress
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
if (!b)
|
if (!b)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -246,11 +256,17 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count)
|
||||||
if (xE->u.u.detail <= 5)
|
if (xE->u.u.detail <= 5)
|
||||||
b->state |= (Button1Mask >> 1) << xE->u.u.detail;
|
b->state |= (Button1Mask >> 1) << xE->u.u.detail;
|
||||||
SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
|
SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
|
||||||
if (!grab)
|
#ifdef MPX
|
||||||
if (CheckDeviceGrabs(other, xE, 0, count))
|
if (xE->u.u.type == DeviceButtonPress)
|
||||||
return;
|
#endif
|
||||||
|
if (!grab)
|
||||||
|
if (CheckDeviceGrabs(other, xE, 0, count))
|
||||||
|
return;
|
||||||
|
|
||||||
} else if (xE->u.u.type == DeviceButtonRelease) {
|
} else if (xE->u.u.type == DeviceButtonRelease
|
||||||
|
#ifdef MPX
|
||||||
|
|| xE->u.u.type == MPXButtonRelease
|
||||||
|
#endif) {
|
||||||
if (!b)
|
if (!b)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -266,8 +282,11 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count)
|
||||||
if (xE->u.u.detail <= 5)
|
if (xE->u.u.detail <= 5)
|
||||||
b->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
|
b->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
|
||||||
SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
|
SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
|
||||||
if (!b->state && other->fromPassiveGrab)
|
#ifdef MPX
|
||||||
deactivateDeviceGrab = TRUE;
|
if (xE->u.u.type == DeviceButtonRelease)
|
||||||
|
#endif
|
||||||
|
if (!b->state && other->fromPassiveGrab)
|
||||||
|
deactivateDeviceGrab = TRUE;
|
||||||
} else if (xE->u.u.type == ProximityIn)
|
} else if (xE->u.u.type == ProximityIn)
|
||||||
other->valuator->mode &= ~OutOfProximity;
|
other->valuator->mode &= ~OutOfProximity;
|
||||||
else if (xE->u.u.type == ProximityOut)
|
else if (xE->u.u.type == ProximityOut)
|
||||||
|
|
|
@ -28,7 +28,7 @@ void
|
||||||
SReplyMPXDispatch (
|
SReplyMPXDispatch (
|
||||||
ClientPtr /* client */,
|
ClientPtr /* client */,
|
||||||
int /* len */,
|
int /* len */,
|
||||||
mpxGetExtensionVersionReply * /* rep */
|
xMPXGetExtensionVersionReply * /* rep */
|
||||||
);
|
);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -12,5 +12,7 @@ libmpx_la_SOURCES = \
|
||||||
selectev.h \
|
selectev.h \
|
||||||
mpxglobals.h \
|
mpxglobals.h \
|
||||||
getevbase.c \
|
getevbase.c \
|
||||||
getevbase.h
|
getevbase.h \
|
||||||
|
queryptr.h \
|
||||||
|
queryptr.c
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
//#include "gcstruct.h" /* pointer for extnsionst.h */
|
|
||||||
#include "extnsionst.h" /* extension entry */
|
#include "extnsionst.h" /* extension entry */
|
||||||
#include <X11/extensions/MPX.h>
|
#include <X11/extensions/MPX.h>
|
||||||
#include <X11/extensions/MPXproto.h>
|
#include <X11/extensions/MPXproto.h>
|
||||||
|
@ -21,6 +20,7 @@
|
||||||
#include "listdev.h"
|
#include "listdev.h"
|
||||||
#include "selectev.h"
|
#include "selectev.h"
|
||||||
#include "getevbase.h"
|
#include "getevbase.h"
|
||||||
|
#include "queryptr.h"
|
||||||
|
|
||||||
static Mask lastExtEventMask = 1;
|
static Mask lastExtEventMask = 1;
|
||||||
int MPXEventIndex;
|
int MPXEventIndex;
|
||||||
|
@ -74,7 +74,6 @@ int MPXLastEvent;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static MPXExtensionVersion thisversion = {
|
static MPXExtensionVersion thisversion = {
|
||||||
MPX_Present,
|
|
||||||
MPX_Major,
|
MPX_Major,
|
||||||
MPX_Minor
|
MPX_Minor
|
||||||
};
|
};
|
||||||
|
@ -125,14 +124,16 @@ int
|
||||||
ProcMPXDispatch(register ClientPtr client)
|
ProcMPXDispatch(register ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
if (stuff->data == MPX_GetExtensionVersion)
|
if (stuff->data == X_MPXGetExtensionVersion)
|
||||||
return (ProcMPXGetExtensionVersion(client));
|
return (ProcMPXGetExtensionVersion(client));
|
||||||
if (stuff->data == MPX_ListDevices)
|
if (stuff->data == X_MPXListDevices)
|
||||||
return (ProcMPXListDevices(client));
|
return (ProcMPXListDevices(client));
|
||||||
if (stuff->data == MPX_SelectEvents)
|
if (stuff->data == X_MPXSelectEvents)
|
||||||
return (ProcMPXSelectEvents(client));
|
return (ProcMPXSelectEvents(client));
|
||||||
if (stuff->data == MPX_GetEventBase)
|
if (stuff->data == X_MPXGetEventBase)
|
||||||
return (ProcMPXGetEventBase(client));
|
return (ProcMPXGetEventBase(client));
|
||||||
|
if (stuff->data == X_MPXQueryPointer)
|
||||||
|
return (ProcMPXQueryPointer(client));
|
||||||
else {
|
else {
|
||||||
SendErrorToClient(client, MPXReqCode, stuff->data, 0, BadRequest);
|
SendErrorToClient(client, MPXReqCode, stuff->data, 0, BadRequest);
|
||||||
}
|
}
|
||||||
|
@ -153,14 +154,16 @@ int
|
||||||
SProcMPXDispatch(register ClientPtr client)
|
SProcMPXDispatch(register ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
if (stuff->data == MPX_GetExtensionVersion)
|
if (stuff->data == X_MPXGetExtensionVersion)
|
||||||
return (SProcMPXGetExtensionVersion(client));
|
return (SProcMPXGetExtensionVersion(client));
|
||||||
if (stuff->data == MPX_ListDevices)
|
if (stuff->data == X_MPXListDevices)
|
||||||
return (SProcMPXListDevices(client));
|
return (SProcMPXListDevices(client));
|
||||||
if (stuff->data == MPX_SelectEvents)
|
if (stuff->data == X_MPXSelectEvents)
|
||||||
return (SProcMPXSelectEvents(client));
|
return (SProcMPXSelectEvents(client));
|
||||||
if (stuff->data == MPX_GetEventBase)
|
if (stuff->data == X_MPXGetEventBase)
|
||||||
return (SProcMPXGetEventBase(client));
|
return (SProcMPXGetEventBase(client));
|
||||||
|
if (stuff->data == X_MPXQueryPointer)
|
||||||
|
return (SProcMPXQueryPointer(client));
|
||||||
else {
|
else {
|
||||||
SendErrorToClient(client, MPXReqCode, stuff->data, 0, BadRequest);
|
SendErrorToClient(client, MPXReqCode, stuff->data, 0, BadRequest);
|
||||||
}
|
}
|
||||||
|
@ -188,14 +191,14 @@ MPXResetProc(ExtensionEntry* unused)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SReplyMPXDispatch(ClientPtr client, int len, mpxGetExtensionVersionReply* rep)
|
void SReplyMPXDispatch(ClientPtr client, int len, xMPXGetExtensionVersionReply* rep)
|
||||||
{
|
{
|
||||||
if (rep->RepType == MPX_GetExtensionVersion)
|
if (rep->RepType == X_MPXGetExtensionVersion)
|
||||||
SRepMPXGetExtensionVersion(client, len,
|
SRepMPXGetExtensionVersion(client, len,
|
||||||
(mpxGetExtensionVersionReply*) rep);
|
(xMPXGetExtensionVersionReply*) rep);
|
||||||
if (rep->RepType == MPX_ListDevices)
|
if (rep->RepType == X_MPXListDevices)
|
||||||
SRepMPXListDevices(client, len,
|
SRepMPXListDevices(client, len,
|
||||||
(mpxListDevicesReply*) rep);
|
(xMPXListDevicesReply*) rep);
|
||||||
else {
|
else {
|
||||||
FatalError("MPX confused sending swapped reply");
|
FatalError("MPX confused sending swapped reply");
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,20 +20,20 @@
|
||||||
int
|
int
|
||||||
ProcMPXGetEventBase(register ClientPtr client)
|
ProcMPXGetEventBase(register ClientPtr client)
|
||||||
{
|
{
|
||||||
mpxGetEventBaseReply rep;
|
xMPXGetEventBaseReply rep;
|
||||||
|
|
||||||
REQUEST(mpxGetEventBaseReq);
|
REQUEST(xMPXGetEventBaseReq);
|
||||||
REQUEST_SIZE_MATCH(mpxGetEventBaseReq);
|
REQUEST_SIZE_MATCH(xMPXGetEventBaseReq);
|
||||||
|
|
||||||
memset(&rep, 0, sizeof(mpxGetEventBaseReply));
|
memset(&rep, 0, sizeof(xMPXGetEventBaseReply));
|
||||||
rep.repType = X_Reply;
|
rep.repType = X_Reply;
|
||||||
rep.RepType = MPX_GetEventBase;
|
rep.RepType = X_MPXGetEventBase;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
|
|
||||||
rep.eventBase = MPXEventBase;
|
rep.eventBase = MPXEventBase;
|
||||||
|
|
||||||
WriteReplyToClient(client, sizeof(mpxGetEventBaseReply), &rep);
|
WriteReplyToClient(client, sizeof(xMPXGetEventBaseReply), &rep);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -47,9 +47,9 @@ SProcMPXGetEventBase(register ClientPtr client)
|
||||||
{
|
{
|
||||||
register char n;
|
register char n;
|
||||||
|
|
||||||
REQUEST(mpxGetEventBaseReq);
|
REQUEST(xMPXGetEventBaseReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
REQUEST_SIZE_MATCH(mpxGetEventBaseReq);
|
REQUEST_SIZE_MATCH(xMPXGetEventBaseReq);
|
||||||
return (ProcMPXGetEventBase(client));
|
return (ProcMPXGetEventBase(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,11 @@ SProcMPXGetExtensionVersion(register ClientPtr client)
|
||||||
{
|
{
|
||||||
register char n;
|
register char n;
|
||||||
|
|
||||||
REQUEST(mpxGetExtensionVersionReq);
|
REQUEST(xMPXGetExtensionVersionReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
swaps(&stuff->major_version, n);
|
swaps(&stuff->major_version, n);
|
||||||
swaps(&stuff->minor_version, n);
|
swaps(&stuff->minor_version, n);
|
||||||
REQUEST_AT_LEAST_SIZE(mpxGetExtensionVersionReq);
|
REQUEST_AT_LEAST_SIZE(xMPXGetExtensionVersionReq);
|
||||||
return (ProcMPXGetExtensionVersion(client));
|
return (ProcMPXGetExtensionVersion(client));
|
||||||
}
|
}
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -41,19 +41,19 @@ SProcMPXGetExtensionVersion(register ClientPtr client)
|
||||||
int
|
int
|
||||||
ProcMPXGetExtensionVersion(register ClientPtr client)
|
ProcMPXGetExtensionVersion(register ClientPtr client)
|
||||||
{
|
{
|
||||||
mpxGetExtensionVersionReply rep;
|
xMPXGetExtensionVersionReply rep;
|
||||||
|
|
||||||
REQUEST(mpxGetExtensionVersionReq);
|
REQUEST(xMPXGetExtensionVersionReq);
|
||||||
REQUEST_SIZE_MATCH(mpxGetExtensionVersionReq);
|
REQUEST_SIZE_MATCH(xMPXGetExtensionVersionReq);
|
||||||
|
|
||||||
rep.repType = X_Reply;
|
rep.repType = X_Reply;
|
||||||
rep.RepType = MPX_GetExtensionVersion;
|
rep.RepType = X_MPXGetExtensionVersion;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
|
|
||||||
rep.major_version = AllExtensionVersions[MPXReqCode - 128].major_version;
|
rep.major_version = AllExtensionVersions[MPXReqCode - 128].major;
|
||||||
rep.minor_version = AllExtensionVersions[MPXReqCode - 128].minor_version;
|
rep.minor_version = AllExtensionVersions[MPXReqCode - 128].minor;
|
||||||
WriteReplyToClient(client, sizeof(mpxGetExtensionVersionReply), &rep);
|
WriteReplyToClient(client, sizeof(xMPXGetExtensionVersionReply), &rep);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ ProcMPXGetExtensionVersion(register ClientPtr client)
|
||||||
|
|
||||||
void
|
void
|
||||||
SRepMPXGetExtensionVersion(ClientPtr client, int size,
|
SRepMPXGetExtensionVersion(ClientPtr client, int size,
|
||||||
mpxGetExtensionVersionReply * rep)
|
xMPXGetExtensionVersionReply * rep)
|
||||||
{
|
{
|
||||||
register char n;
|
register char n;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ int ProcMPXGetExtensionVersion(ClientPtr /* client */
|
||||||
|
|
||||||
void SRepMPXGetExtensionVersion(ClientPtr /* client */ ,
|
void SRepMPXGetExtensionVersion(ClientPtr /* client */ ,
|
||||||
int /* size */ ,
|
int /* size */ ,
|
||||||
mpxGetExtensionVersionReply * /* rep */
|
xMPXGetExtensionVersionReply * /* rep */
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,7 +25,7 @@ int SProcMPXListDevices(register ClientPtr client)
|
||||||
{
|
{
|
||||||
register char n;
|
register char n;
|
||||||
|
|
||||||
REQUEST(mpxListDevicesReq);
|
REQUEST(xMPXListDevicesReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
return (ProcMPXListDevices(client));
|
return (ProcMPXListDevices(client));
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ int SProcMPXListDevices(register ClientPtr client)
|
||||||
*/
|
*/
|
||||||
int ProcMPXListDevices(register ClientPtr client)
|
int ProcMPXListDevices(register ClientPtr client)
|
||||||
{
|
{
|
||||||
mpxListDevicesReply rep;
|
xMPXListDevicesReply rep;
|
||||||
int numdevs = 0;
|
int numdevs = 0;
|
||||||
int namesize = 1; /* need 1 extra byte for strcpy */
|
int namesize = 1; /* need 1 extra byte for strcpy */
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
@ -46,13 +46,13 @@ int ProcMPXListDevices(register ClientPtr client)
|
||||||
char* devbuf;
|
char* devbuf;
|
||||||
char* namebuf;
|
char* namebuf;
|
||||||
char *savbuf;
|
char *savbuf;
|
||||||
mpxDeviceInfoPtr dev;
|
xMPXDeviceInfoPtr dev;
|
||||||
DeviceIntPtr d;
|
DeviceIntPtr d;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(mpxListDevicesReq);
|
REQUEST_SIZE_MATCH(xMPXListDevicesReq);
|
||||||
memset(&rep, 0, sizeof(mpxListDevicesReply));
|
memset(&rep, 0, sizeof(xMPXListDevicesReply));
|
||||||
rep.repType = X_Reply;
|
rep.repType = X_Reply;
|
||||||
rep.RepType = MPX_ListDevices;
|
rep.RepType = X_MPXListDevices;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
|
|
||||||
|
@ -72,12 +72,12 @@ int ProcMPXListDevices(register ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
total_length = numdevs * sizeof(mpxDeviceInfo) + size + namesize;
|
total_length = numdevs * sizeof(xMPXDeviceInfo) + size + namesize;
|
||||||
devbuf = (char *)xalloc(total_length);
|
devbuf = (char *)xalloc(total_length);
|
||||||
namebuf = devbuf + (numdevs * sizeof(mpxDeviceInfo));
|
namebuf = devbuf + (numdevs * sizeof(xMPXDeviceInfo));
|
||||||
savbuf = devbuf;
|
savbuf = devbuf;
|
||||||
|
|
||||||
dev = (mpxDeviceInfoPtr) devbuf;
|
dev = (xMPXDeviceInfoPtr) devbuf;
|
||||||
for (d = inputInfo.devices; d; d = d->next, dev++)
|
for (d = inputInfo.devices; d; d = d->next, dev++)
|
||||||
if (d->isMPDev)
|
if (d->isMPDev)
|
||||||
SetMPXDeviceInfo(client, d, dev, &devbuf, &namebuf);
|
SetMPXDeviceInfo(client, d, dev, &devbuf, &namebuf);
|
||||||
|
@ -87,7 +87,7 @@ int ProcMPXListDevices(register ClientPtr client)
|
||||||
|
|
||||||
rep.ndevices = numdevs;
|
rep.ndevices = numdevs;
|
||||||
rep.length = (total_length + 3) >> 2;
|
rep.length = (total_length + 3) >> 2;
|
||||||
WriteReplyToClient(client, sizeof(mpxListDevicesReply), &rep);
|
WriteReplyToClient(client, sizeof(xMPXListDevicesReply), &rep);
|
||||||
WriteToClient(client, total_length, savbuf);
|
WriteToClient(client, total_length, savbuf);
|
||||||
xfree(savbuf);
|
xfree(savbuf);
|
||||||
return Success;
|
return Success;
|
||||||
|
@ -115,7 +115,7 @@ SizeMPXDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
SetMPXDeviceInfo(ClientPtr client, DeviceIntPtr d, mpxDeviceInfoPtr dev,
|
SetMPXDeviceInfo(ClientPtr client, DeviceIntPtr d, xMPXDeviceInfoPtr dev,
|
||||||
char **devbuf, char **namebuf)
|
char **devbuf, char **namebuf)
|
||||||
{
|
{
|
||||||
MPXCopyDeviceName(namebuf, d->name);
|
MPXCopyDeviceName(namebuf, d->name);
|
||||||
|
@ -157,17 +157,17 @@ void
|
||||||
MPXCopySwapDevice(register ClientPtr client, DeviceIntPtr d, char **buf)
|
MPXCopySwapDevice(register ClientPtr client, DeviceIntPtr d, char **buf)
|
||||||
{
|
{
|
||||||
register char n;
|
register char n;
|
||||||
mpxDeviceInfoPtr dev;
|
xMPXDeviceInfoPtr dev;
|
||||||
|
|
||||||
dev = (mpxDeviceInfoPtr) * buf;
|
dev = (xMPXDeviceInfoPtr) * buf;
|
||||||
memset(dev, 0, sizeof(mpxDeviceInfo));
|
memset(dev, 0, sizeof(xMPXDeviceInfo));
|
||||||
|
|
||||||
dev->id = d->id;
|
dev->id = d->id;
|
||||||
dev->type = d->type;
|
dev->type = d->type;
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swapl(&dev->type, n); /* macro - braces are required */
|
swapl(&dev->type, n); /* macro - braces are required */
|
||||||
}
|
}
|
||||||
*buf += sizeof(mpxDeviceInfo);
|
*buf += sizeof(xMPXDeviceInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -177,7 +177,7 @@ MPXCopySwapDevice(register ClientPtr client, DeviceIntPtr d, char **buf)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
SRepMPXListDevices(ClientPtr client, int size, mpxListDevicesReply * rep)
|
SRepMPXListDevices(ClientPtr client, int size, xMPXListDevicesReply * rep)
|
||||||
{
|
{
|
||||||
register char n;
|
register char n;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ void SizeMPXDeviceInfo(DeviceIntPtr /* d */ ,
|
||||||
|
|
||||||
void SetMPXDeviceInfo(ClientPtr /* client */ ,
|
void SetMPXDeviceInfo(ClientPtr /* client */ ,
|
||||||
DeviceIntPtr /* d */ ,
|
DeviceIntPtr /* d */ ,
|
||||||
mpxDeviceInfoPtr /* dev */ ,
|
xMPXDeviceInfoPtr /* dev */ ,
|
||||||
char ** /* devbuf */ ,
|
char ** /* devbuf */ ,
|
||||||
char ** /* namebuf */
|
char ** /* namebuf */
|
||||||
);
|
);
|
||||||
|
@ -48,6 +48,6 @@ void MPXCopySwapDevice(ClientPtr /* client */ ,
|
||||||
|
|
||||||
void SRepMPXListDevices(ClientPtr /* client */ ,
|
void SRepMPXListDevices(ClientPtr /* client */ ,
|
||||||
int /* size */ ,
|
int /* size */ ,
|
||||||
mpxListDevicesReply * /* rep */
|
xMPXListDevicesReply * /* rep */
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
90
mpx/queryptr.c
Normal file
90
mpx/queryptr.c
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/* Copyright 2006 by Peter Hutterer <peter@cs.unisa.edu.au> */
|
||||||
|
|
||||||
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
#include <dix-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <X11/X.h>
|
||||||
|
#include <X11/Xproto.h>
|
||||||
|
#include "inputstr.h"
|
||||||
|
#include "windowstr.h"
|
||||||
|
#include <X11/extensions/MPX.h>
|
||||||
|
#include <X11/extensions/MPXproto.h>
|
||||||
|
|
||||||
|
#include "mpxglobals.h"
|
||||||
|
|
||||||
|
#include "queryptr.h"
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
*
|
||||||
|
* This procedure writes the reply for the MPXQueryPointer function.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
ProcMPXQueryPointer(register ClientPtr client)
|
||||||
|
{
|
||||||
|
xMPXQueryPointerReply rep;
|
||||||
|
DeviceIntPtr pDev;
|
||||||
|
WindowPtr root, win;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
REQUEST(xMPXQueryPointerReq);
|
||||||
|
REQUEST_SIZE_MATCH(xMPXQueryPointerReq);
|
||||||
|
|
||||||
|
pDev = LookupDeviceIntRec(stuff->deviceid);
|
||||||
|
if (!pDev->isMPDev)
|
||||||
|
{
|
||||||
|
SendErrorToClient(client, MPXReqCode, X_MPXQueryPointer,
|
||||||
|
stuff->deviceid, BadValue);
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
memset(&rep, 0, sizeof(xMPXQueryPointerReply));
|
||||||
|
rep.repType = X_Reply;
|
||||||
|
rep.RepType = X_MPXQueryPointer;
|
||||||
|
rep.length = 0;
|
||||||
|
rep.sequenceNumber = client->sequence;
|
||||||
|
|
||||||
|
root = GetCurrentRootWindow();
|
||||||
|
win = GetSpriteWindow(pDev);
|
||||||
|
GetSpritePosition(pDev, &x, &y);
|
||||||
|
|
||||||
|
rep.root = root->drawable.id;
|
||||||
|
rep.root_x = x;
|
||||||
|
rep.root_y = y;
|
||||||
|
if (win != root)
|
||||||
|
{
|
||||||
|
rep.child = win->drawable.id;
|
||||||
|
rep.win_x = x - win->drawable.x;
|
||||||
|
rep.win_y = y - win->drawable.y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rep.child = None;
|
||||||
|
rep.win_x = x;
|
||||||
|
rep.win_y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rep.mask = pDev->button->state | inputInfo.keyboard->key->state;
|
||||||
|
|
||||||
|
WriteReplyToClient(client, sizeof(xMPXQueryPointerReply), &rep);
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
*
|
||||||
|
* This procedure writes the reply for the MPXQueryPointer function.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
SProcMPXQueryPointer(register ClientPtr client)
|
||||||
|
{
|
||||||
|
register char n;
|
||||||
|
|
||||||
|
REQUEST(xMPXQueryPointerReq);
|
||||||
|
swaps(&stuff->length, n);
|
||||||
|
REQUEST_SIZE_MATCH(xMPXQueryPointerReq);
|
||||||
|
return (ProcMPXQueryPointer(client));
|
||||||
|
}
|
16
mpx/queryptr.h
Normal file
16
mpx/queryptr.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/* Copyright 2006 by Peter Hutterer <peter@cs.unisa.edu.au> */
|
||||||
|
|
||||||
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
#include <dix-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef QUERYPTR_H
|
||||||
|
#define QUERYPTR_H 1
|
||||||
|
|
||||||
|
int SProcMPXQueryPointer(ClientPtr /* client */
|
||||||
|
);
|
||||||
|
|
||||||
|
int ProcMPXQueryPointer(ClientPtr /* client */
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif /* QUERYPTR_H */
|
|
@ -42,9 +42,9 @@ SProcMPXSelectEvents(register ClientPtr client)
|
||||||
{
|
{
|
||||||
register char n;
|
register char n;
|
||||||
|
|
||||||
REQUEST(mpxSelectEventsReq);
|
REQUEST(xMPXSelectEventsReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
REQUEST_SIZE_MATCH(mpxSelectEventsReq);
|
REQUEST_SIZE_MATCH(xMPXSelectEventsReq);
|
||||||
swapl(&stuff->window, n);
|
swapl(&stuff->window, n);
|
||||||
return (ProcMPXSelectEvents(client));
|
return (ProcMPXSelectEvents(client));
|
||||||
}
|
}
|
||||||
|
@ -61,12 +61,12 @@ ProcMPXSelectEvents(register ClientPtr client)
|
||||||
int ret;
|
int ret;
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
|
|
||||||
REQUEST(mpxSelectEventsReq);
|
REQUEST(xMPXSelectEventsReq);
|
||||||
REQUEST_SIZE_MATCH(mpxSelectEventsReq);
|
REQUEST_SIZE_MATCH(xMPXSelectEventsReq);
|
||||||
|
|
||||||
if (stuff->length != (sizeof(mpxSelectEventsReq) >> 2))
|
if (stuff->length != (sizeof(xMPXSelectEventsReq) >> 2))
|
||||||
{
|
{
|
||||||
SendErrorToClient(client, MPXReqCode, MPX_SelectEvents, 0,
|
SendErrorToClient(client, MPXReqCode, X_MPXSelectEvents, 0,
|
||||||
BadLength);
|
BadLength);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ ProcMPXSelectEvents(register ClientPtr client)
|
||||||
if (!pWin)
|
if (!pWin)
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->window;
|
client->errorValue = stuff->window;
|
||||||
SendErrorToClient(client, MPXReqCode, MPX_SelectEvents, 0,
|
SendErrorToClient(client, MPXReqCode, X_MPXSelectEvents, 0,
|
||||||
BadWindow);
|
BadWindow);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -83,13 +83,13 @@ ProcMPXSelectEvents(register ClientPtr client)
|
||||||
if (stuff->mask >= MPXHighestMask)
|
if (stuff->mask >= MPXHighestMask)
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->mask;
|
client->errorValue = stuff->mask;
|
||||||
SendErrorToClient(client, MPXReqCode, MPX_SelectEvents, 0,
|
SendErrorToClient(client, MPXReqCode, X_MPXSelectEvents, 0,
|
||||||
BadValue);
|
BadValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = MPXSelectForWindow(pWin, client, stuff->mask)) != Success)
|
if ((ret = MPXSelectForWindow(pWin, client, stuff->mask)) != Success)
|
||||||
{
|
{
|
||||||
SendErrorToClient(client, MPXReqCode, MPX_SelectEvents, 0, ret);
|
SendErrorToClient(client, MPXReqCode, X_MPXSelectEvents, 0, ret);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user