aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xext/geext.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/Xext/geext.c')
-rw-r--r--xorg-server/Xext/geext.c87
1 files changed, 40 insertions, 47 deletions
diff --git a/xorg-server/Xext/geext.c b/xorg-server/Xext/geext.c
index a8718ccbd..07028238e 100644
--- a/xorg-server/Xext/geext.c
+++ b/xorg-server/Xext/geext.c
@@ -35,18 +35,18 @@
DevPrivateKeyRec GEClientPrivateKeyRec;
-int RT_GECLIENT = 0;
+int RT_GECLIENT = 0;
GEExtension GEExtensions[MAXEXTENSIONS];
/* Major available requests */
static const int version_requests[] = {
- X_GEQueryVersion, /* before client sends QueryVersion */
- X_GEQueryVersion, /* must be set to last request in version 1 */
+ X_GEQueryVersion, /* before client sends QueryVersion */
+ X_GEQueryVersion, /* must be set to last request in version 1 */
};
/* Forward declarations */
-static void SGEGenericEvent(xEvent* from, xEvent* to);
+static void SGEGenericEvent(xEvent *from, xEvent *to);
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
#define EXT_MASK(ext) ((ext) & 0x7F)
@@ -60,6 +60,7 @@ ProcGEQueryVersion(ClientPtr client)
{
GEClientInfoPtr pGEClient = GEGetClient(client);
xGEQueryVersionReply rep;
+
REQUEST(xGEQueryVersionReq);
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
@@ -77,22 +78,20 @@ ProcGEQueryVersion(ClientPtr client)
pGEClient->major_version = stuff->majorVersion;
pGEClient->minor_version = stuff->minorVersion;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xGEQueryVersionReply), (char*)&rep);
+ WriteToClient(client, sizeof(xGEQueryVersionReply), (char *) &rep);
return Success;
}
-int (*ProcGEVector[GENumberRequests])(ClientPtr) = {
+int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
- ProcGEQueryVersion
-};
+ProcGEQueryVersion};
/************************************************************/
/* swapped request handlers */
@@ -106,14 +105,12 @@ SProcGEQueryVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
- return(*ProcGEVector[stuff->ReqType])(client);
+ return (*ProcGEVector[stuff->ReqType]) (client);
}
-int (*SProcGEVector[GENumberRequests])(ClientPtr) = {
+int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
- SProcGEQueryVersion
-};
-
+SProcGEQueryVersion};
/************************************************************/
/* callbacks */
@@ -124,6 +121,7 @@ static int
ProcGEDispatch(ClientPtr client)
{
GEClientInfoPtr pGEClient = GEGetClient(client);
+
REQUEST(xGEReq);
if (pGEClient->major_version >= NUM_VERSION_REQUESTS)
@@ -131,7 +129,7 @@ ProcGEDispatch(ClientPtr client)
if (stuff->ReqType > version_requests[pGEClient->major_version])
return BadRequest;
- return (ProcGEVector[stuff->ReqType])(client);
+ return (ProcGEVector[stuff->ReqType]) (client);
}
/* dispatch swapped requests */
@@ -141,7 +139,7 @@ SProcGEDispatch(ClientPtr client)
REQUEST(xGEReq);
if (stuff->ReqType >= GENumberRequests)
return BadRequest;
- return (*SProcGEVector[stuff->ReqType])(client);
+ return (*SProcGEVector[stuff->ReqType]) (client);
}
/**
@@ -151,13 +149,11 @@ SProcGEDispatch(ClientPtr client)
* used in the furture for versioning support.
*/
static void
-GEClientCallback(CallbackListPtr *list,
- pointer closure,
- pointer data)
+GEClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- GEClientInfoPtr pGEClient = GEGetClient(pClient);
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ GEClientInfoPtr pGEClient = GEGetClient(pClient);
pGEClient->major_version = 0;
pGEClient->minor_version = 0;
@@ -165,7 +161,7 @@ GEClientCallback(CallbackListPtr *list,
/* Reset extension. Called on server shutdown. */
static void
-GEResetProc(ExtensionEntry *extEntry)
+GEResetProc(ExtensionEntry * extEntry)
{
DeleteCallback(&ClientStateCallback, GEClientCallback, 0);
EventSwapVector[GenericEvent] = NotImplemented;
@@ -179,13 +175,12 @@ GEResetProc(ExtensionEntry *extEntry)
* work.
*/
static void
-SGEGenericEvent(xEvent* from, xEvent* to)
+SGEGenericEvent(xEvent *from, xEvent *to)
{
- xGenericEvent* gefrom = (xGenericEvent*)from;
- xGenericEvent* geto = (xGenericEvent*)to;
+ xGenericEvent *gefrom = (xGenericEvent *) from;
+ xGenericEvent *geto = (xGenericEvent *) to;
- if ((gefrom->extension & 0x7f) > MAXEXTENSIONS)
- {
+ if ((gefrom->extension & 0x7f) > MAXEXTENSIONS) {
ErrorF("GE: Invalid extension offset for event.\n");
return;
}
@@ -203,23 +198,23 @@ GEExtensionInit(void)
{
ExtensionEntry *extEntry;
- if (!dixRegisterPrivateKey(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
+ if (!dixRegisterPrivateKey
+ (&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
FatalError("GEExtensionInit: GE private request failed.\n");
- if(!AddCallback(&ClientStateCallback, GEClientCallback, 0))
- {
+ if (!AddCallback(&ClientStateCallback, GEClientCallback, 0)) {
FatalError("GEExtensionInit: register client callback failed.\n");
}
- if((extEntry = AddExtension(GE_NAME,
- 0, GENumberErrors,
- ProcGEDispatch, SProcGEDispatch,
- GEResetProc, StandardMinorOpcode)) != 0)
- {
+ if ((extEntry = AddExtension(GE_NAME,
+ 0, GENumberErrors,
+ ProcGEDispatch, SProcGEDispatch,
+ GEResetProc, StandardMinorOpcode)) != 0) {
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
- } else {
+ }
+ else {
FatalError("GEInit: AddExtensions failed.\n");
}
@@ -238,24 +233,22 @@ GEExtensionInit(void)
*/
void
GERegisterExtension(int extension,
- void (*ev_swap)(xGenericEvent* from, xGenericEvent* to))
+ void (*ev_swap) (xGenericEvent *from, xGenericEvent *to))
{
- if (EXT_MASK(extension) >= MAXEXTENSIONS)
+ if (EXT_MASK(extension) >= MAXEXTENSIONS)
FatalError("GE: extension > MAXEXTENSIONS. This should not happen.\n");
/* extension opcodes are > 128, might as well save some space here */
GEExtensions[EXT_MASK(extension)].evswap = ev_swap;
}
-
/* Sets type and extension field for a generic event. This is just an
* auxiliary function, extensions could do it manually too.
*/
void
-GEInitEvent(xGenericEvent* ev, int extension)
+GEInitEvent(xGenericEvent *ev, int extension)
{
ev->type = GenericEvent;
ev->extension = extension;
ev->length = 0;
}
-