Xext: panoramiX: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping much easier. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
587e00e167
commit
a5f44e4c59
|
@ -32,6 +32,7 @@ Equipment Corporation.
|
||||||
#include <X11/extensions/panoramiXproto.h>
|
#include <X11/extensions/panoramiXproto.h>
|
||||||
|
|
||||||
#include "dix/dix_priv.h"
|
#include "dix/dix_priv.h"
|
||||||
|
#include "dix/request_priv.h"
|
||||||
#include "dix/resource_priv.h"
|
#include "dix/resource_priv.h"
|
||||||
#include "dix/screen_hooks_priv.h"
|
#include "dix/screen_hooks_priv.h"
|
||||||
#include "Xext/panoramiX.h"
|
#include "Xext/panoramiX.h"
|
||||||
|
@ -457,7 +458,8 @@ PanoramiXExtensionInit(void)
|
||||||
while (panoramiXGeneration != serverGeneration) {
|
while (panoramiXGeneration != serverGeneration) {
|
||||||
extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0,
|
extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0,
|
||||||
ProcPanoramiXDispatch,
|
ProcPanoramiXDispatch,
|
||||||
SProcPanoramiXDispatch, PanoramiXResetProc,
|
ProcPanoramiXDispatch,
|
||||||
|
PanoramiXResetProc,
|
||||||
StandardMinorOpcode);
|
StandardMinorOpcode);
|
||||||
if (!extEntry)
|
if (!extEntry)
|
||||||
break;
|
break;
|
||||||
|
@ -898,7 +900,8 @@ PanoramiXResetProc(ExtensionEntry * extEntry)
|
||||||
int
|
int
|
||||||
ProcPanoramiXQueryVersion(ClientPtr client)
|
ProcPanoramiXQueryVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
/* REQUEST(xPanoramiXQueryVersionReq); */
|
REQUEST_HEAD_STRUCT(xPanoramiXQueryVersionReq);
|
||||||
|
|
||||||
xPanoramiXQueryVersionReply rep = {
|
xPanoramiXQueryVersionReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
@ -907,7 +910,6 @@ ProcPanoramiXQueryVersion(ClientPtr client)
|
||||||
.minorVersion = SERVER_PANORAMIX_MINOR_VERSION
|
.minorVersion = SERVER_PANORAMIX_MINOR_VERSION
|
||||||
};
|
};
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
@ -921,12 +923,13 @@ ProcPanoramiXQueryVersion(ClientPtr client)
|
||||||
int
|
int
|
||||||
ProcPanoramiXGetState(ClientPtr client)
|
ProcPanoramiXGetState(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xPanoramiXGetStateReq);
|
REQUEST_HEAD_STRUCT(xPanoramiXGetStateReq);
|
||||||
|
REQUEST_FIELD_CARD32(window);
|
||||||
|
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
xPanoramiXGetStateReply rep;
|
xPanoramiXGetStateReply rep;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -951,12 +954,13 @@ ProcPanoramiXGetState(ClientPtr client)
|
||||||
int
|
int
|
||||||
ProcPanoramiXGetScreenCount(ClientPtr client)
|
ProcPanoramiXGetScreenCount(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xPanoramiXGetScreenCountReq);
|
REQUEST_HEAD_STRUCT(xPanoramiXGetScreenCountReq);
|
||||||
|
REQUEST_FIELD_CARD32(window);
|
||||||
|
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
xPanoramiXGetScreenCountReply rep;
|
xPanoramiXGetScreenCountReply rep;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -980,13 +984,14 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
|
||||||
int
|
int
|
||||||
ProcPanoramiXGetScreenSize(ClientPtr client)
|
ProcPanoramiXGetScreenSize(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xPanoramiXGetScreenSizeReq);
|
REQUEST_HEAD_STRUCT(xPanoramiXGetScreenSizeReq);
|
||||||
|
REQUEST_FIELD_CARD32(window);
|
||||||
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
xPanoramiXGetScreenSizeReply rep;
|
xPanoramiXGetScreenSizeReply rep;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
|
||||||
|
|
||||||
if (stuff->screen >= PanoramiXNumScreens)
|
if (stuff->screen >= PanoramiXNumScreens)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
|
|
||||||
|
@ -1019,12 +1024,9 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
|
||||||
int
|
int
|
||||||
ProcXineramaIsActive(ClientPtr client)
|
ProcXineramaIsActive(ClientPtr client)
|
||||||
{
|
{
|
||||||
/* REQUEST(xXineramaIsActiveReq); */
|
REQUEST_HEAD_STRUCT(xXineramaIsActiveReq);
|
||||||
xXineramaIsActiveReply rep;
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
|
xXineramaIsActiveReply rep = {
|
||||||
|
|
||||||
rep = (xXineramaIsActiveReply) {
|
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0,
|
.length = 0,
|
||||||
|
@ -1048,7 +1050,8 @@ ProcXineramaIsActive(ClientPtr client)
|
||||||
int
|
int
|
||||||
ProcXineramaQueryScreens(ClientPtr client)
|
ProcXineramaQueryScreens(ClientPtr client)
|
||||||
{
|
{
|
||||||
/* REQUEST(xXineramaQueryScreensReq); */
|
REQUEST_HEAD_STRUCT(xXineramaQueryScreensReq);
|
||||||
|
|
||||||
CARD32 number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
|
CARD32 number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
|
||||||
xXineramaQueryScreensReply rep = {
|
xXineramaQueryScreensReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
|
@ -1057,8 +1060,6 @@ ProcXineramaQueryScreens(ClientPtr client)
|
||||||
.number = number
|
.number = number
|
||||||
};
|
};
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
|
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
/*****************************************************************
|
|
||||||
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software.
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
|
||||||
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
||||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
Except as contained in this notice, the name of Digital Equipment Corporation
|
|
||||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
|
||||||
dealings in this Software without prior written authorization from Digital
|
|
||||||
Equipment Corporation.
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
#include <dix-config.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xproto.h>
|
|
||||||
#include <X11/extensions/panoramiXproto.h>
|
|
||||||
|
|
||||||
#include "Xext/panoramiX.h"
|
|
||||||
#include "Xext/panoramiXsrv.h"
|
|
||||||
|
|
||||||
#include "misc.h"
|
|
||||||
#include "cursor.h"
|
|
||||||
#include "cursorstr.h"
|
|
||||||
#include "extnsionst.h"
|
|
||||||
#include "dixstruct.h"
|
|
||||||
#include "gc.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "window.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "globals.h"
|
|
||||||
#include "panoramiXh.h"
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcPanoramiXGetState(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xPanoramiXGetStateReq);
|
|
||||||
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
|
|
||||||
swapl(&stuff->window);
|
|
||||||
return ProcPanoramiXGetState(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcPanoramiXGetScreenCount(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xPanoramiXGetScreenCountReq);
|
|
||||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
|
|
||||||
swapl(&stuff->window);
|
|
||||||
return ProcPanoramiXGetScreenCount(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcPanoramiXGetScreenSize(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xPanoramiXGetScreenSizeReq);
|
|
||||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
|
||||||
swapl(&stuff->window);
|
|
||||||
swapl(&stuff->screen);
|
|
||||||
return ProcPanoramiXGetScreenSize(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _X_COLD
|
|
||||||
SProcPanoramiXDispatch(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xReq);
|
|
||||||
switch (stuff->data) {
|
|
||||||
case X_PanoramiXQueryVersion:
|
|
||||||
return ProcPanoramiXQueryVersion(client);
|
|
||||||
case X_PanoramiXGetState:
|
|
||||||
return SProcPanoramiXGetState(client);
|
|
||||||
case X_PanoramiXGetScreenCount:
|
|
||||||
return SProcPanoramiXGetScreenCount(client);
|
|
||||||
case X_PanoramiXGetScreenSize:
|
|
||||||
return SProcPanoramiXGetScreenSize(client);
|
|
||||||
case X_XineramaIsActive:
|
|
||||||
return ProcXineramaIsActive(client);
|
|
||||||
case X_XineramaQueryScreens:
|
|
||||||
return ProcXineramaQueryScreens(client);
|
|
||||||
}
|
|
||||||
return BadRequest;
|
|
||||||
}
|
|
|
@ -65,8 +65,6 @@ PROC_EXTERN(ProcPanoramiXGetScreenSize);
|
||||||
PROC_EXTERN(ProcXineramaQueryScreens);
|
PROC_EXTERN(ProcXineramaQueryScreens);
|
||||||
PROC_EXTERN(ProcXineramaIsActive);
|
PROC_EXTERN(ProcXineramaIsActive);
|
||||||
|
|
||||||
extern int SProcPanoramiXDispatch(ClientPtr client);
|
|
||||||
|
|
||||||
extern int connBlockScreenStart;
|
extern int connBlockScreenStart;
|
||||||
extern xConnSetupPrefix connSetupPrefix;
|
extern xConnSetupPrefix connSetupPrefix;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue