Xext: panoramiX: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
a5f44e4c59
commit
dc39130899
102
Xext/panoramiX.c
102
Xext/panoramiX.c
|
@ -903,21 +903,13 @@ ProcPanoramiXQueryVersion(ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xPanoramiXQueryVersionReq);
|
REQUEST_HEAD_STRUCT(xPanoramiXQueryVersionReq);
|
||||||
|
|
||||||
xPanoramiXQueryVersionReply rep = {
|
xPanoramiXQueryVersionReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION,
|
.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION,
|
||||||
.minorVersion = SERVER_PANORAMIX_MINOR_VERSION
|
.minorVersion = SERVER_PANORAMIX_MINOR_VERSION
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(majorVersion);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(minorVersion);
|
||||||
swapl(&rep.length);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swaps(&rep.majorVersion);
|
|
||||||
swaps(&rep.minorVersion);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -927,28 +919,18 @@ ProcPanoramiXGetState(ClientPtr client)
|
||||||
REQUEST_FIELD_CARD32(window);
|
REQUEST_FIELD_CARD32(window);
|
||||||
|
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
xPanoramiXGetStateReply rep;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rep = (xPanoramiXGetStateReply) {
|
xPanoramiXGetStateReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.state = !noPanoramiXExtension,
|
.state = !noPanoramiXExtension,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.window = stuff->window
|
.window = stuff->window
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(window);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swapl(&rep.length);
|
|
||||||
swapl(&rep.window);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep);
|
|
||||||
return Success;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -958,27 +940,19 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
|
||||||
REQUEST_FIELD_CARD32(window);
|
REQUEST_FIELD_CARD32(window);
|
||||||
|
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
xPanoramiXGetScreenCountReply rep;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rep = (xPanoramiXGetScreenCountReply) {
|
xPanoramiXGetScreenCountReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.ScreenCount = PanoramiXNumScreens,
|
.ScreenCount = PanoramiXNumScreens,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.window = stuff->window
|
.window = stuff->window
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(window);
|
||||||
swapl(&rep.length);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swapl(&rep.window);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -989,7 +963,6 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
|
||||||
REQUEST_FIELD_CARD32(screen);
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
xPanoramiXGetScreenSizeReply rep;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (stuff->screen >= PanoramiXNumScreens)
|
if (stuff->screen >= PanoramiXNumScreens)
|
||||||
|
@ -999,26 +972,19 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rep = (xPanoramiXGetScreenSizeReply) {
|
xPanoramiXGetScreenSizeReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
/* screen dimensions */
|
/* screen dimensions */
|
||||||
.width = screenInfo.screens[stuff->screen]->width,
|
.width = screenInfo.screens[stuff->screen]->width,
|
||||||
.height = screenInfo.screens[stuff->screen]->height,
|
.height = screenInfo.screens[stuff->screen]->height,
|
||||||
.window = stuff->window,
|
.window = stuff->window,
|
||||||
.screen = stuff->screen
|
.screen = stuff->screen
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(width);
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD32(height);
|
||||||
swapl(&rep.width);
|
REPLY_FIELD_CARD32(window);
|
||||||
swapl(&rep.height);
|
REPLY_FIELD_CARD32(screen);
|
||||||
swapl(&rep.window);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swapl(&rep.screen);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1027,9 +993,6 @@ ProcXineramaIsActive(ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xXineramaIsActiveReq);
|
REQUEST_HEAD_STRUCT(xXineramaIsActiveReq);
|
||||||
|
|
||||||
xXineramaIsActiveReply rep = {
|
xXineramaIsActiveReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
#if 1
|
#if 1
|
||||||
/* The following hack fools clients into thinking that Xinerama
|
/* The following hack fools clients into thinking that Xinerama
|
||||||
* is disabled even though it is not. */
|
* is disabled even though it is not. */
|
||||||
|
@ -1038,13 +1001,9 @@ ProcXineramaIsActive(ClientPtr client)
|
||||||
.state = !noPanoramiXExtension;
|
.state = !noPanoramiXExtension;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(state);
|
||||||
swapl(&rep.length);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swapl(&rep.state);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXineramaIsActiveReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1054,21 +1013,13 @@ ProcXineramaQueryScreens(ClientPtr client)
|
||||||
|
|
||||||
CARD32 number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
|
CARD32 number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
|
||||||
xXineramaQueryScreensReply rep = {
|
xXineramaQueryScreensReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = bytes_to_int32(number * sz_XineramaScreenInfo),
|
.length = bytes_to_int32(number * sz_XineramaScreenInfo),
|
||||||
.number = number
|
.number = number
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
xXineramaScreenInfo scratch[number]; // upper bound limited, number of screens
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
swapl(&rep.number);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
|
|
||||||
|
|
||||||
if (!noPanoramiXExtension) {
|
if (!noPanoramiXExtension) {
|
||||||
xXineramaScreenInfo scratch[number]; // upper bound limited, number of screens
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
FOR_NSCREENS_BACKWARD(i) {
|
FOR_NSCREENS_BACKWARD(i) {
|
||||||
|
@ -1076,17 +1027,12 @@ ProcXineramaQueryScreens(ClientPtr client)
|
||||||
scratch[i].y_org = screenInfo.screens[i]->y;
|
scratch[i].y_org = screenInfo.screens[i]->y;
|
||||||
scratch[i].width = screenInfo.screens[i]->width;
|
scratch[i].width = screenInfo.screens[i]->width;
|
||||||
scratch[i].height = screenInfo.screens[i]->height;
|
scratch[i].height = screenInfo.screens[i]->height;
|
||||||
|
CLIENT_STRUCT_CARD16_4(&scratch[i], x_org, y_org, width, height);
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&scratch[i].x_org);
|
|
||||||
swaps(&scratch[i].y_org);
|
|
||||||
swaps(&scratch[i].width);
|
|
||||||
swaps(&scratch[i].height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WriteToClient(client, sizeof(scratch), &scratch);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
REPLY_FIELD_CARD32(number);
|
||||||
|
REPLY_SEND_EXTRA(scratch, sizeof(scratch));
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue